On 05/18/2011 12:45 PM, Marc Lehmann wrote: > On Wed, May 18, 2011 at 10:43:15AM +0200, Joachim Nilsson > <[email protected]> wrote: >> timeout.it_value.tv_sec = 10; >> setitimer(ITIMER_REAL, &timeout, NULL); >> if (connect (...) == -1) { ... } >> timeout = NULL_TIMER; >> setitimer (ITIMER_REAL, &timeout, NULL); >> Is this OK for use with libev? > yes, although it defeats the purpose of using an event library when you > then stop the whole program for a connect - if you know you have nothing > else to do while you connect, this is fine though.
OK. (Yes, we're aware of the limitation... a full redesign is imminent, but we need to ship sth asap.) >> or do you have any other recommendation? > if you want to do sth. else, do a nonblocking connect (and use a normal > libev timer and a write watcher to detect when the connect has finished). Alright, as I suspected. Which is also a better design. Thanks! >> Basically we're a bit concerned if it conflicts with the internal timer >> implementation, or event loop, in libev. > No, you are safe as long as you handle SIGALRM (remember that sigalrm > terminates your program). libev does not use sigalrm at the moment and > there are no plans for it to ever use it, at least not by default. Nice, I did not know that (that libev does not, or ever intend to rely on SIGALRM). Very useful piece of information for us that are too lazy to actually look at the implementation. Thanks Marc! Regards /Joachim _______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
