[zeromq-dev] [PATCH] Section about thread-safeness in zmq(7) simplified
ph at imatix.com
Fri May 20 10:28:36 CEST 2011
On Fri, May 20, 2011 at 10:23 AM, Martin Lucina <mato at kotelna.sk> wrote:
> So what is the "best practice" then?
> Or are you just trying to put people off from migrating sockets as much as
> possible? I.e. the "If you don't know what this means, don't use it"
You missed the key story here, which was that people were
systematically passing sockets between threads, and doing it wrong,
and getting asserts. This was happening 2-3 times a week.
So we looked at this thread spawning pattern and decided it was better
to pass contexts but not sockets, and then we changed the Guide to
explain that. This piece of the doc should have been fixed too but
Basically, passing sockets around is for system-level work only, i.e.
language bindings that have to do this, not application level work.
Undocumenting this and providing alternate patterns that were more
robust did in fact reduce the number of accidents to close to zero.
More information about the zeromq-dev