2012/7/5 Stephen Hemminger <[email protected]>

>
> You can have a per-thread pool of sockets, but you can't create socket
> in one thread and then use it in another.


You CAN create in one thread and then use it in another - just ensure
there's a memory barrier in the middle.


> 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.
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to