[PLUG] Asynchronous Notification

Abhijit Bhopatkar bain at devslashzero.com
Wed Mar 11 00:40:01 PDT 2009


> Hi all,
<snip>
>
> So my problem is, I am changing the status of gpio pin twice, according to
> documentation I will get SIGIO signal twice.
> But It don't happen so, I got SIGIO only once.
> Please any one tell me why this happen?

Signal delivery is mysterious in linux, atleast to the novice eye.
Ok here is the deal,

First, there is a small window where you usually will miss signals.
When your handler gets called, linux resets the handler for that
signal and the handler needs to reinstall itself again. Now untill you
do that if another signal is queued, it will be delivered to default
handler, in caso of SIGIO nothing will be done.

Second matter with the signals is that they are not at all queued, if
a signal of same type happens when previous one is not yet delivered,
it will not be queued etc. There is just one bit to say weather signal
is raised or not and no count associated with it.

First one can be fixed by using the new posix signal API ( google it,
i believe its "sigaction" or something) second has no solution. Just
make sure you have consumed all the things from driver before exiting
the signal handler, this might be racy, i really don't know the
answer.

BAIN



More information about the plug-mail mailing list