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 rhe 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.

> 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).

> Basically we're a bit concerned if it conflicts with the internal timer
> implementation, or event loop, in libev.

No, you are save 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.

-- 
                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

Reply via email to