summary refs log tree commit diff stats
path: root/lib/pure/asyncdispatch.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-03-06 10:15:27 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-06 10:15:27 +0100
commit32c9ca605e407bdcb288c66a3ed23625bf2474be (patch)
tree11db462f115de935bc68ddfae814ddd074fbe7fd /lib/pure/asyncdispatch.nim
parente3e4cd9fd5fd72264676b8a1d1297751be85d7cf (diff)
downloadNim-32c9ca605e407bdcb288c66a3ed23625bf2474be.tar.gz
fixes #10795
Diffstat (limited to 'lib/pure/asyncdispatch.nim')
-rw-r--r--lib/pure/asyncdispatch.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index 5953ed975..08fa60dbc 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -167,7 +167,7 @@ export asyncstreams
 type
   PDispatcherBase = ref object of RootRef
     timers*: HeapQueue[tuple[finishAt: float, fut: Future[void]]]
-    callbacks*: Deque[proc ()]
+    callbacks*: Deque[proc () {.gcsafe.}]
 
 proc processTimers(
   p: PDispatcherBase, didSomeWork: var bool
@@ -200,7 +200,9 @@ proc adjustTimeout(pollTimeout: int, nextTimer: Option[int]): int {.inline.} =
   if pollTimeout == -1: return
   result = min(pollTimeout, result)
 
-proc callSoon*(cbproc: proc ()) {.gcsafe.}
+proc callSoon*(cbproc: proc () {.gcsafe.}) {.gcsafe.}
+  ## Schedule `cbproc` to be called as soon as possible.
+  ## The callback is called when control returns to the event loop.
 
 proc initCallSoonProc =
   if asyncfutures.getCallSoonProc().isNil:
@@ -1806,9 +1808,7 @@ proc readAll*(future: FutureStream[string]): Future[string] {.async.} =
     else:
       break
 
-proc callSoon*(cbproc: proc ()) =
-  ## Schedule `cbproc` to be called as soon as possible.
-  ## The callback is called when control returns to the event loop.
+proc callSoon(cbproc: proc () {.gcsafe.}) =
   getGlobalDispatcher().callbacks.addLast(cbproc)
 
 proc runForever*() =