Interesting! Does anyone know what "No handles or timers registered in 
dispatcher" actually mean? That is, why is it an error?

Regarding the compiler, I hadn't thought about trying different compilers to 
work around crashes. But unfortunately, I want to use this in UE4, and UE4 
pretty much requires VC under Windows, so I'll need a work around. I guess I 
could just add a dummy timer, for a start.

EDIT: OK, I added a "timer" (based on [this 
thread](https://forum.nim-lang.org/t/1195)); it made no difference:
    
    
    import asyncdispatch
    import os
    
    proc doNothing() {.async.} =
      while true:
        await sleepAsync(100)
    
    proc runForeverThread() {.thread.} =
      ## Executes runForever() in a separate thread.
      runForever()
    
    proc initProcess(): void =
      debugEcho("In initProcess()")
      asyncCheck doNothing()
      var thread: Thread[void]
      createThread(thread, runForeverThread)
    
    proc doStuff(): void =
      debugEcho("In doStuff()")
      # ...
      initProcess()
      sleep(500)
      # ...
      debugEcho("After initProcess()")
    
    doStuff()
    

Reply via email to