[...]
>> the way to handle that properly is to check for any pending signals
>> before you enter the select call (while blocking any from coming in) and
>> then checking after the select returns. this can only be done correctly
>> in C.
>
>There's no way in perl or C that I know of to atomically set a signal
>mask and enter a select call.  I've seen rumors of a pselect library
>call available on some systems that can do this.  A sigprocmask call
>followed by a select call has a race condition, because a signal can
>come in between the two statements.  How do you solve this in C?  I've
>seen a klugey solution that requires a setjmp/longjmp.

A long time ago in a galaxy far away I got the same problem with 
the Linux kernel 2.0.x.

I was writting a driver for A/D board I have build and I had to make the
driver sleep before the interrupt happened after I set it up for making a read.

Unfortunally that was too fast and the interrupt happened almost always 
before get to sleep.

The only way I found to do it is to edit the queue and set the driver as 
"sleeping" before it really was sleeping.  So after puting it to sleep I would get
the call to process the interrupt imediatly.

Regards,

Raul Dias


Reply via email to