>From the manual of poll(): Waits for completion events and processes them. 
>Raises ValueError if there are no pending operations. The implementation 
>raises the error if:

if p.handles.len == 0 and p.timers.len == 0 and p.callbacks.len == 0:

Your example runs fine if you protect the poll call similar to:

proc runForeverThread() {.thread.} =
    ## Executes runForever() in a separate thread.

if hasPendingOperations():
    runForever()

Reply via email to