lkml.org 
[lkml]   [2001]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Desperately missing a working "pselect()" or similar...
On Friday October 5, alex@pennace.org wrote:
> On Fri, Oct 05, 2001 at 10:36:53PM +0200, Bernd Eckenfels wrote:
> > In article <3BBDD37D.56D7B359@isg.de> you wrote:
> > > Without a proper pselect() implementation (the one in glibc is just
> > > a mock-up that doesn't prevent the race condition) I'm currently
> > > unable to come up with a good idea on how to wait on both types
> > > of events.
> >
> > Isnt select() returning with EINTR?
>
> The select system call doesn't return EINTR when the signal is caught
> prior to entry into select.

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.

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

\
 
 \ /
  Last update: 2005-03-22 13:04    [from the cache]
©2003-2011 Jasper Spaans