On Mon, Jul 07, 2008 at 03:54:21PM +0300, vvvua <[EMAIL PROTECTED]> wrote: > When ev_loop finishes to maintain all registered timers, it waits on > epoll, and epoll waits for events from sockets. > When i register a new timer in the second thread, ev_loop still waits on > epoll...
Of course, this is not allowed. > To resolve this problem i created a heartbeat timer in the main thread. It's not a solution, your program will just crash at different times now. Get a book about threads programming and elarn about race conditions, and how to avoid them (e.g. by using a mutex). Also refer to the threads section in the libev manual. In short, if you don't lock the loop yourself, then the only thing you can do in another thread is to call ev_async_send. > Another solution - is to set timeout on sockets read/write operations. Not sure what that solves, but you need to understand thread programming and use proper locking to avoid races, otherwise your program runs into undefined behaviour (most likely, crashes). This is all documented in the libev documentation, however. -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / [EMAIL PROTECTED] -=====/_/_//_/\_,_/ /_/\_\ _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev