split FutureStream from asyncfutures

This commit is contained in:
Michał Zieliński 2017-06-05 14:44:12 +02:00
commit 93827e6ab8
4 changed files with 117 additions and 109 deletions

View file

@ -9,11 +9,12 @@
include "system/inclrtl"
import os, tables, strutils, times, heapqueue, options, asyncfutures
import os, tables, strutils, times, heapqueue, options, asyncstreams
import asyncfutures except callSoon
import nativesockets, net, deques
export Port, SocketFlag
export asyncfutures
export asyncfutures, asyncstreams
#{.injectStmt: newGcInvariant().}
@ -188,7 +189,7 @@ proc adjustedTimeout(p: PDispatcherBase, timeout: int): int {.inline.} =
result = int((timerTimeout - curTime) * 1000)
if result < 0: result = 0
proc callSoon*(cbproc: proc ()) {.gcsafe.}
proc callSoon(cbproc: proc ()) {.gcsafe.}
proc initGlobalDispatcher =
if asyncfutures.callSoonProc == nil:
@ -1336,7 +1337,7 @@ proc recvLine*(socket: AsyncFD): Future[string] {.async, deprecated.} =
return
add(result, c)
proc callSoon*(cbproc: proc ()) =
proc callSoon(cbproc: proc ()) =
## Schedule `cbproc` to be called as soon as possible.
## The callback is called when control returns to the event loop.
getGlobalDispatcher().callbacks.addLast(cbproc)