asyncdispatch: add callSoon getter/setter, renames

This commit is contained in:
Michał Zieliński 2017-07-06 13:24:33 +02:00
commit 6bdd00db0e
3 changed files with 24 additions and 13 deletions

View file

@ -191,9 +191,9 @@ proc adjustedTimeout(p: PDispatcherBase, timeout: int): int {.inline.} =
proc callSoon(cbproc: proc ()) {.gcsafe.}
proc initGlobalDispatcher =
if asyncfutures.callSoonProc == nil:
asyncfutures.callSoonProc = callSoon
proc initCallSoonProc =
if asyncfutures.getCallSoonProc() == nil:
asyncfutures.setCallSoonProc(callSoon)
when defined(windows) or defined(nimdoc):
import winlean, sets, hashes
@ -247,7 +247,7 @@ when defined(windows) or defined(nimdoc):
if not gDisp.isNil:
assert gDisp.callbacks.len == 0
gDisp = disp
initGlobalDispatcher()
initCallSoonProc()
proc getGlobalDispatcher*(): PDispatcher =
if gDisp.isNil:
@ -944,7 +944,7 @@ else:
if not gDisp.isNil:
assert gDisp.callbacks.len == 0
gDisp = disp
initGlobalDispatcher()
initCallSoonProc()
proc getGlobalDispatcher*(): PDispatcher =
if gDisp.isNil: