Clarify library thread-safety
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)`: https://github.com/JuliaInterop/ZMQ.jl/blob/b4f30ae817be3d7854fdb7c0e7920758afa45750/src/context.jl#L74-L82
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).
0 条评论