多个排队和工作队列

发布于 2024-09-12 10:46:43 字数 94 浏览 3 评论 0原文

我正在学习工作队列来编写Linux内核中的下半部分。 我想知道:如果中断处理程序被执行两次(因此调用schedule_work两次),工作队列处理程序会被调用一次还是两次?

I'm learning the Work queues to code bottom halves in the linux kernel.
I wonder: if the interrupt handler is executed two times (thus calling schedule_work two times), does the work queue handler be called once or twice?

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

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

发布评论

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

评论(1

烧了回忆取暖 2024-09-19 10:46:43

看起来您的答案在该函数的注释中。

/**
 * schedule_work - put work task in global workqueue
 * @work: job to be done
 *
 * Returns zero if @work was already on the kernel-global workqueue and
 * non-zero otherwise.
 *
 * This puts a job in the kernel-global workqueue if it was not already
 * queued and leaves it in the same position on the kernel-global
 * workqueue otherwise.
 */
int schedule_work(struct work_struct *work)
{
        return queue_work(keventd_wq, work);
}

Looks like your answer is in the comment for the function.

/**
 * schedule_work - put work task in global workqueue
 * @work: job to be done
 *
 * Returns zero if @work was already on the kernel-global workqueue and
 * non-zero otherwise.
 *
 * This puts a job in the kernel-global workqueue if it was not already
 * queued and leaves it in the same position on the kernel-global
 * workqueue otherwise.
 */
int schedule_work(struct work_struct *work)
{
        return queue_work(keventd_wq, work);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文