Chinaunix首页 | 论坛 | 博客
  • 博客访问: 337538
  • 博文数量: 61
  • 博客积分: 2816
  • 博客等级: 少校
  • 技术积分: 880
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-18 23:38
文章存档

2012年(1)

2011年(19)

2010年(41)

分类: LINUX

2010-09-01 21:52:20

wait_event_interruptible()
    wait_event_interruptible()。该函数修改task的状态为TASK_INTERRUPTIBLE,意味着改进程将不会继续运行直到被唤醒,然后被添加到等待队列wq中。
    在wait_event_interruptible()中首先判断condition是不是已经满足,如果是则直接返回0,否则调用__wait_event_interruptible(),并用__ret来存放返回值
condition=0 就是睡眠了。
---------------------------------------------------------------
#define wait_event_interruptible(wq, condition)          \
({                                                       \
    int __ret = 0;                                       \
    if (!(condition))                                    \
        __wait_event_interruptible(wq, condition, __ret);\
    __ret;                                               \
})
阅读(1724) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-09-03 15:34:14

Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com