could anyone tell me about how to exit the program using libev

2012-06-28 Thread debuguo
I just find that it seems not stopped when ev_beak has been called, even after ev_loop_destroy. I have stop all the watchers in the loop, and called the ev_break() in one thread, and another thread(containing the ev_run) will still execute the ev_run and write callback. I don't know why and I want

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread Zsbán Ambrus
On Thu, Jun 28, 2012 at 10:51 AM, debuguo waterawo...@gmail.com wrote: I just find that it seems not stopped when ev_beak has been called, even after ev_loop_destroy. I have stop all the watchers in the loop, and called the ev_break() in one thread, and another thread(containing the ev_run)

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread Marc Lehmann
On Thu, Jun 28, 2012 at 04:51:38PM +0800, debuguo waterawo...@gmail.com wrote: I have stop all the watchers in the loop, and called the ev_break() in one thread, and another thread(containing the ev_run) will still execute the ev_run and write callback. You cannot call ev_break from another

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread debuguo
must I call ev_run() in one function, and call ev_break() in the same funtion? 2012/6/28 Zsbán Ambrus amb...@math.bme.hu On Thu, Jun 28, 2012 at 11:46 AM, Marc Lehmann schm...@schmorp.de wrote: On Thu, Jun 28, 2012 at 04:51:38PM +0800, debuguo waterawo...@gmail.com wrote: I have stop all

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread Marc Lehmann
On Thu, Jun 28, 2012 at 11:52:02AM +0200, Zsbán Ambrus amb...@math.bme.hu wrote: You cannot call ev_break from another thread - a loop is a shared resource, and would need to be locked properly. Ah, correct. I didn't read the original question properly. Sorry. What Zsbán wrote still

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread Marc Lehmann
On Thu, Jun 28, 2012 at 06:35:42PM +0800, debuguo waterawo...@gmail.com wrote: must I call ev_run() in one function, and call ev_break() in the same funtion? no, it doesn't matter where you call these, as long as they are called from within the same thread (or with appropriate locking and

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread debuguo
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? 2012/6/28 debuguo waterawo...@gmail.com must I call

Re: could anyone tell me about how to exit the program using libev

2012-06-28 Thread Marc Lehmann
On Thu, Jun 28, 2012 at 06:52:08PM +0800, debuguo waterawo...@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