janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
122 stars 35 forks source link

Is there a way to Manually poll for requests with Netrepl? #61

Closed phillvancejr closed 2 years ago

phillvancejr commented 2 years ago

I'd like to be able to run an infinite loop on the main thread so I can run a gui program, but this of course blocks the main process. Is there a way to manually tell netrepl to poll for requests so I can use this main loop? In Lisp with swank I can use swank::handle-requests in an infinite loop to keep things working. So is there something like netrepl/handle-requests that I can use in the following way:

(while true
    (netrepl/handle-requests)
    (my-update-function))
phillvancejr commented 2 years ago

Solved my use case by using ev/sleep in main loop