[zeromq-dev] [PATCH] Section about thread-safeness in zmq(7) simplified

Martin Lucina mato at kotelna.sk
Fri May 20 14:44:04 CEST 2011


ph at imatix.com said:
> 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"
> > approach?
> 
> 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
> escaped.
> 
> 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.

OK, thanks for the explanation.

-mato



More information about the zeromq-dev mailing list