4 implementations of nonblocking_read_loop:
#1
/digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-request.xtm ·
#2
/digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-reply.xtm ·
#3
/digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-respondent.xtm ·
#4
/digego/extempore/tree/v0.8.9/examples/contrib/nanomsg-surveyor.xtm
(bind-func nonblocking_read_loop
(let ((buflen:i64 1024)
(buf:i8* (zalloc buflen))
(continue #t))
(lambda ()
(if (< SURVEYOR_SOCKET 0)
(nn_println_strerror)
(let ((nbytes (nn_recv SURVEYOR_SOCKET buf buflen NN_DONTWAIT)))
;; if we get some bytes, trigger the callback
(if (> nbytes 0)
(print_response buf nbytes))))
(if continue
(callback (+ (now) 1000) nonblocking_read_loop)
(begin
(println "stopping nonblocking_read_loop")
0)))))