How to know when a schedule() call is returning because of a signal?
In a device driver for some PCI hardware, I have an ioctl
call that waits for an incoming interrupt on the PCI bus. Using wait_queue_head开发者_运维问答_t
, I put the task to sleep by calling schedule()
.
Then, the irq_handler
function wakes up this task when the interrupt is raised on the PCI bus. Everything seems to work correctly.
My question is how to differentiate whether the schedule()
call is returning because of my irq_handler
function wake it up, or because some signal has been send?
Do I have to handle it by myself with flags in the irq_handler
function?
Something along the lines of this, after the schedule
call:
if (signal_pending(current)) {
retval = -EINTR;
精彩评论