如何知道 Schedule() 调用何时因信号而返回?

发布于 2024-08-13 18:25:32 字数 340 浏览 2 评论 0原文

在某些 PCI 硬件的设备驱动程序中,我有一个 ioctl 调用,用于等待 PCI 总线上的传入中断。使用 wait_queue_head_t,我通过调用 schedule() 让任务进入睡眠状态。

然后,当 PCI 总线上产生中断时,irq_handler 函数会唤醒该任务。一切似乎都工作正常。

我的问题是如何区分 schedule() 调用返回是因为我的 irq_handler 函数唤醒它,还是因为发送了某些信号?

我必须自己使用 irq_handler 函数中的标志来处理它吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

败给现实 2024-08-20 18:25:32

schedule 调用之后,大致如下:

if (signal_pending(current)) {
    retval = -EINTR;

Something along the lines of this, after the schedule call:

if (signal_pending(current)) {
    retval = -EINTR;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文