Skip to content

Commit 776257f

Browse files
authored
fix heartbeat on 1.6 (#985)
1 parent 941c548 commit 776257f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
88
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
1010
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
11+
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1112
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
1213
MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d"
1314
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

src/heartbeat.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44
# call in libzmq, which simply blocks forever, so the usual lack of
55
# thread safety in Julia should not be an issue here.
66

7+
import Libdl
78

89
const threadid = zeros(Int, 128) # sizeof(uv_thread_t) <= 8 on Linux, OSX, Win
9-
using ZMQ: libzmq
10+
const zmq_proxy = Ref(C_NULL)
1011

1112
# entry point for new thread
1213
function heartbeat_thread(sock::Ptr{Cvoid})
13-
ccall((:zmq_proxy,libzmq), Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
14+
ccall(zmq_proxy[], Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
1415
sock, sock, C_NULL)
1516
nothing
1617
end
1718

1819
function start_heartbeat(sock)
20+
zmq_proxy[] = Libdl.dlsym(Libdl.dlopen(ZMQ.libzmq), :zmq_proxy)
1921
heartbeat_c = @cfunction(heartbeat_thread, Cvoid, (Ptr{Cvoid},))
2022
ccall(:uv_thread_create, Cint, (Ptr{Int}, Ptr{Cvoid}, Ptr{Cvoid}),
2123
threadid, heartbeat_c, sock)

0 commit comments

Comments
 (0)