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

Alan Cox
2001-10-05T23:58:12Z

> 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