Re: [libuv] Socket I/O and thread pool

122 views
Skip to first unread message

Fedor Indutny

unread,
Apr 29, 2013, 12:19:53 PM4/29/13
to li...@googlegroups.com
Hi,

You can create multiple threads and use separate event-loop for each of them. By definition Event-Loop is a single-threaded process model.

Also, you can off-load computational work to thread-pool workers by using uv_enqueue_work and friends.

Cheers,
Fedor.


On Mon, Apr 29, 2013 at 7:18 PM, Philippe Pinto <iisv...@gmail.com> wrote:
Hello,
I'm coding a server daemon and I would like to add use libuv which looks a really nice piece of code however I've a few questions.
I've read the docs saying that an event loop can only run into a single thread which removes all the unneeded sync-ing which you can find in libraries such as boost::asio for instance where you can use several threads sharing the same i/o event loop. 
This is one of the primary reason, I choosed libuv and dropped boost::asio because of those design choises.
However, I don't understand how your implementation works (I attempt to review your iocp/epoll impl to figure out but failed). I mean, does libuv spawn threads automatically when launching a new event loop ? How can I handle thousands of connections i/o requests upon a single thread (my 32 core machines becomes a waste :p), can the networking I/O events be dispatched upon severals event_loop which rely one the same iocp handle/epoll handle etc? I looked in the code and figured no however can someone give me hints ?

Regards

--
You received this message because you are subscribed to the Google Groups "libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libuv+un...@googlegroups.com.
To post to this group, send email to li...@googlegroups.com.
Visit this group at http://groups.google.com/group/libuv?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages