could anyone tell me about how to exit the program using libev
debuguo
wateraworld at gmail.com
Thu Jun 28 14:35:15 CEST 2012
Thank you very much. you two are so kind-hearted. i'll try it latter.
2012/6/28 Marc Lehmann <schmorp at schmorp.de>
> On Thu, Jun 28, 2012 at 06:52:08PM +0800, debuguo <wateraworld at gmail.com>
> 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
> --==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
> -=====/_/_//_/\_,_/ /_/\_\
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20120628/131bca5b/attachment.html>
More information about the libev
mailing list