On Thu, Jun 28, 2012 at 06:52:08PM +0800, debuguo <[email protected]> wrote:
> In start() function, I called ev_loop_new() to create some loops, then
> created some threads in which ev_run() each loop.
> In stop() function, I called ev_break() to stop each loop, then
> ev_loop_destroy to release resources.
> And I WRONG?
Yes, when accessing a shared resource from multiple threads, you'd have to
use some kind of locking or other synchronsiation.
You can create async watchers for those loops that call ev_break, and then
use ev_async_send from your stop function.
You might also question the use of threads - threads are definitely very
complex beasts, and maybe libev is not the best library to learn your way
around threads.
--
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