[zeromq-dev] Using zmq sockets from multiple threads

Peter Durkan pdurkan at lucerahq.com
Thu Aug 21 16:59:14 CEST 2014


Thanks Charles.




On Thu, Aug 21, 2014 at 10:57 AM, Charles Remes <lists at chuckremes.com>
wrote:

> Yes.
>
> http://zeromq.org/area:faq
>
> cr
>
> On Aug 21, 2014, at 9:53 AM, Peter Durkan <pdurkan at lucerahq.com> wrote:
>
> > Hi,
> >
> > Is it safe to use sockets from multiple threads if you prevent
> concurrent access using a mutex?
> >
> > i.e.
> >
> > {
> >   std::lock_guard<std::mutex> lck(send_mtx_);
> >   ... send a message on the  socket
> > }
> >
> > I can also create a new socket each time a new thread calls the function
> and use the thread_id as a key but was wondering if using a mutex like the
> above would get around that.
> >
> > Thanks,
> > Peter
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140821/b872c1cf/attachment.html>


More information about the zeromq-dev mailing list