From 004e0fbd83a2d1dcae2e6a50127e0b231cb62d19 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Thu, 19 Apr 2018 11:02:46 -0400 Subject: [PATCH] fix heartbeat thread for latest ZMQ --- src/heartbeat.jl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/heartbeat.jl b/src/heartbeat.jl index 0a4f02db..fc72d74e 100644 --- a/src/heartbeat.jl +++ b/src/heartbeat.jl @@ -4,11 +4,21 @@ # call in libzmq, which simply blocks forever, so the usual lack of # thread safety in Julia should not be an issue here. +const libzmq = isdefined(ZMQ, :libzmq) ? ZMQ.libzmq : ZMQ.zmq + # entry point for new thread -function heartbeat_thread(sock::Ptr{Void}) - ccall((:zmq_device,ZMQ.zmq), Cint, (Cint, Ptr{Void}, Ptr{Void}), - ZMQ.QUEUE, sock, sock) - nothing +if ZMQ.version ≥ v"3.2.1" # always true once we require a newer ZMQ.jl + function heartbeat_thread(sock::Ptr{Void}) + ccall((:zmq_proxy,libzmq), Cint, (Ptr{Void}, Ptr{Void}, Ptr{Void}), + sock, sock, C_NULL) + nothing + end +else + function heartbeat_thread(sock::Ptr{Void}) + ccall((:zmq_device,libzmq), Cint, (Cint, Ptr{Void}, Ptr{Void}), + ZMQ.QUEUE, sock, sock) + nothing + end end function start_heartbeat(sock)