Skip to content

Commit 0fb8a19

Browse files
committed
add docsstring to show asyncpoller is experimental
1 parent b3b3aa0 commit 0fb8a19

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

zmq/asynczmq.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ./poller
66
type
77
AsyncZPollCB* = proc(x: ZSocket) {.gcsafe.}
88
AsyncZPoller* = object
9+
## Experimental type to use zmq.poll() with Nim's async dispatch loop
910
cb* : seq[AsyncZPollCB]
1011
zpoll*: ZPoller
1112

@@ -45,6 +46,7 @@ proc initZPoller*(args: openArray[tuple[item: ZConnection, cb: AsyncZPollCB]], e
4546
result.register(arg.item, event, arg.cb)
4647

4748
proc pollAsync*(poller: AsyncZPoller, timeout: int = 1) : Future[int] =
49+
## Experimental API. Poll all the ZConnection and execute an async CB when ``event`` occurs.
4850
result = newFuture[int]("pollAsync")
4951
var r = poller.zpoll.poll(timeout)
5052
# ZMQ can't have a timeout smaller than one
@@ -53,10 +55,9 @@ proc pollAsync*(poller: AsyncZPoller, timeout: int = 1) : Future[int] =
5355
if events(zpoll):
5456
proc localcb = cb(zpoll.socket)
5557
callSoon localcb
56-
5758
if hasPendingOperations():
5859
# poll vs drain ?
59-
drain(timeout)
60+
poll(timeout)
6061

6162
result.complete(r)
6263

0 commit comments

Comments
 (0)