On Thu, Jul 5, 2012 at 3:35 AM, Ivan Pechorin <[email protected]>wrote:

> Can you just have one socket
>> per thread in thread local storage?
>>
>
> Sometime it's not feasible because you don't have control on these threads
> and on their number.
>
> For instance, if you develop some library or component that is intended to
> run inside an existing application or app server, and this app or app
> server uses lots (hundreds or even thousands) of threads, you will hit the
> open file limit at some point if you create socket per thread when really
> all you need is just a pool of few sockets.
>

That's exactly the case. And there is also the problem that I need to close
the sockets before calling zmq_term. I actually tried this solution (TLS)
but it started to look like a code smell, so I revisited the muti-thread
use of sockets.

As a side note, the guide really did a good job keeping me away from using
sockets from multiple threads :)

Thanks,
Thiago
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to