On Mon, Mar 15, 2010 at 02:58:14PM +0100, Christophe Meessen
<[email protected]> wrote:
>> When you can't use a more efficient process model
>> and for some reason *have* to use threads, a lader/follower pattern, or
>> multiple event loops, are usually more preferable. YMMV.
>>
> The pattern I describe is the leader/follower pattern. I just learned it
> was called like that :)
Yeah, after re-reading your e-mail and additional explanations, it seems
like that.
> Is the suggested use of ev_loop( ONE_SHOT ) ok to implement this pattern
> or is there a better way ?
I would experiment by simply handing the event loop to the next
thread in each callback, and acquiring the loop back once finished
(stopping/starting of watchers is required here).
That way your callbacks would compete for the event loop, and the event
loop would only poll once all current callbacks have been invoked - before
each (or each slow) callback, the event loop would be passed to the next
thread.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / [email protected]
-=====/_/_//_/\_,_/ /_/\_\
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev