Re: Desperately missing a working "pselect()" or similar...

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Fri Oct 05 2001 - 19:03:04 EST


> A technique I used in a similar situation once went something like:
>
> tv.tv_sec=bignum;
> tv.tv_usec = 0;
> enable_signals();
> select(nfds, &readfds,&writefds,0,&tv);
>
> and have the signal handlers set tv.tv_sec to 0. (tv is a global
> variable).
>
> Then if the signal comes before the select, the select exits
> immediately.

You can do this more cleanly with sigsetjmp - it avoids any risk of suprises
in the library itself - eg the select to poll mapper in some libraries - and
indeed even the variable load into registers for a syscall
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 07 2001 - 21:00:40 EST