[prev in list] [next in list] [prev in thread] [next in thread]
List: zeromq-dev
Subject: Re: [zeromq-dev] Using zmq sockets from multiple threads
From: Goswin von Brederlow <goswin-v-b () web ! de>
Date: 2014-08-22 10:11:33
Message-ID: 20140822101133.GA22118 () frosties
[Download RAW message or body]
On Thu, Aug 21, 2014 at 10:59:14AM -0400, Peter Durkan wrote:
> Thanks Charles.
>
>
>
>
> On Thu, Aug 21, 2014 at 10:57 AM, Charles Remes <lists@chuckremes.com>
> wrote:
>
> > Yes.
> >
> > http://zeromq.org/area:faq
> >
> > cr
> >
> > On Aug 21, 2014, at 9:53 AM, Peter Durkan <pdurkan@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
Or give each thread a socket to begin with and pass the socket to any
function that will send data.
MfG
Goswin
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic