-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
This library is a pretty thin wrapper around ZMQ and as such exposes most of its semantics, including its lack of threadsafety around sockets. What with Julia 1.12 coming up I think we should consider adding a threadsafe API for Socket
.
I also noticed a case of ZMQ.jl being thread-unsafe in close(::Context)
:
Lines 74 to 82 in b4f30ae
function Base.close(ctx::Context) | |
if isopen(ctx) # don't close twice! | |
for w in getfield(ctx, :sockets) | |
s = w.value | |
if s isa Socket && isopen(s) | |
s.linger = 0 # allow socket to shut down immediately | |
close(s) | |
end | |
end |
The function will first set the linger time of all sockets to 0 and close them, and then terminate the context. This is not threadsafe because the sockets may be running on a separate thread (e.g. the IJulia heartbeat thread).
Metadata
Metadata
Assignees
Labels
No labels