wait event & wake up

在linux驱动中一个常用的场景,

驱动需要等待中断的响应, 才得以执行后续的代码,达到一个原子操作的目的

/* 静态申请队列 */
static DECLARE_WAIT_QUEUE_HEAD(s_wq);
static unsigned int s_cond = 0;

void isr_func(void)
{
    wake_up_interruptible_sync(&s_wq);
}

void func_A ( void)
{
      wait_event_interruptible(s_wq, s_cond)
}
原文地址:https://www.cnblogs.com/chencesc/p/7551981.html