You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having to consume a module that uses asyncdispatch and I'm scratching my head to make it work properly in my fibers/coroutine heavy setup.
I decided to let each coroutine to have it's own dispatcher but sadly I discovered that it's not possible at all due to setGlobalDispatcher being initGlobalDispatcher
This is the proc...
proc setGlobalDispatcher*(disp: PDispatcher) =
if not gDisp.isNil:
assert gDisp.callbacks.len == 0
gDisp = disp
initCallSoonProc()
As you can see it supposedly should set the global dispatcher.. but in the process it asserts that it's empty and initializes it basically.
This makes it impossible to have something like withDispatcher mydispatcher for example
where the template would be:
template withDispatcher*(disp: PDispatcher; body: untyped): untyped =
let currentDispatcher = getGlobalDispatcher()
setGlobalDispatcher(disp)
body
setGlobalDispatcher(currentDispatcher)
To me this makes no sense and both get and init are probably needed.
Currently it's very misleading.
The text was updated successfully, but these errors were encountered:
I'm having to consume a module that uses asyncdispatch and I'm scratching my head to make it work properly in my fibers/coroutine heavy setup.
I decided to let each coroutine to have it's own dispatcher but sadly I discovered that it's not possible at all due to
setGlobalDispatcher
beinginitGlobalDispatcher
This is the proc...
As you can see it supposedly should set the global dispatcher.. but in the process it asserts that it's empty and initializes it basically.
This makes it impossible to have something like
withDispatcher mydispatcher
for examplewhere the template would be:
To me this makes no sense and both get and init are probably needed.
Currently it's very misleading.
The text was updated successfully, but these errors were encountered: