Another piece of info: replacing `std/asyncdispatch` with `chronos` fixes the problem in this case. But the problem returns with the following changes: proc cycler(x: ref MyObj) {.async.} = while true: x.value[] += 1 echo x.value[] await sleepAsync(200) proc main_async() {.async.} = let x = new(MyObj) x[] = newMyObj(3) let fut = cycler(x) await sleepAsync(1000) Run
In this case, the `cycler` coroutine is still pending when the main coroutine (and the thread) finish. So there are still problems with clean-up on thread termination.