[Haskell-cafe] ZeroMQ Thread Safety

David Turner dct25-561bs at mythic-beasts.com
Wed May 27 18:30:42 UTC 2015


Hi all,

According to the ZeroMQ docs[1]:

"Individual ØMQ sockets are not thread safe except in the case where
full memory barriers are issued when migrating a socket from one
thread to another."

The Haskell ZeroMQ binding [2] is a fairly thin wrapper around the C
API, and in particular doesn't seem to do much to enforce thread
safety as described above.

My question: do I need to use bound threads to call functions on
sockets to ensure that all the foreign calls happen on the same OS
thread, or is it the case that two consecutive foreign calls in a
single Haskell thread have a "full memory barrier" between them if
they end up being called from different OS threads?

Thanks in advance,

David



[1] http://api.zeromq.org/4-0:zmq
[2] http://hackage.haskell.org/package/zeromq4-haskell


More information about the Haskell-Cafe mailing list