select and EINTR and SIG33

Greg Smith gsmith at nc.rr.com
Fri Jun 10 21:03:40 UTC 2005


> I have a multi-threaded user app where one thread is doing select() on a
> single fd with a timeout of 1/2th second (500ms).  The fd is not
> expected to be ready very often - it is the keyboard.  However, testing
> shows that select is returning on average every 3.5ms; 99% of the time
> RC == -1 and errno == EINTR.  strace shows the select is being
> interrupted by `Unknown signal 33'.
> 
> I want this thread to be woken up twice a second, not 250+.  I have
> other threads doing useful work.
> 
> What is SIG33?  I suspect that it has something to do with NPTL.  Can I
> block or ignore this signal?  I tried sigfillset() and pthread_sigmask()
> but no joy.  Can I change the behaviour of my other threads to affect
> the frequency of SIG33?  Can I affect which thread is going to get
> SIG33?  Is there a better place to ask this question?

Found the answer to my own questions.  SIG33 definitely has something to
do with NPTL.  It is called SIGSETXID and is raised for every thread in
the process when one of the uids is changed by calling, say, setresuid.
I suppose this is to make sure that all threads are using the right
uids.

I found a piece of brain-dead code in the app calling setresuid a lot.
If you have a threading app, DON'T DO THIS ;-)

Thanks, Ulrich, for making the source readable & understandable.

Greg Smith




More information about the users mailing list