Chinaunix首页 | 论坛 | 博客
  • 博客访问: 725601
  • 博文数量: 118
  • 博客积分: 1437
  • 博客等级: 上尉
  • 技术积分: 1155
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-22 20:23
文章分类

全部博文(118)

文章存档

2022年(32)

2017年(3)

2014年(4)

2013年(1)

2011年(2)

2010年(16)

2009年(60)

我的朋友

分类: LINUX

2009-09-14 19:41:22

  前几天,2410wak_up函数一直有问题,睡眠了之后唤醒不成功,程序假死。终于明白了原来是interruptible_sleep_on deprecated on 2.6 kernels。
过时的原因:
> If the test is made with IRQ closed, and IRQ are then enabled after
> the test but before the call to interruptible_sleep_on, what happen
> if the handler break the procedure immediately before entering the
> interruptible_sleep_on function ? I beleave that the interrupt
> handler, calling the wakeup function, will not wake our process,
> because is not in the waiting list. But at return from IRQ handler,
> the process will continue execution calling the sleep function, and
> nobody will wake it because the data is now already available.

This is why interruptible_sleep_on is deprecated and should not be
used anymore. The wait_event_interruptible, etc. functions avoid this
race since the condition is tested after the caller is put into the
wait queue, so if the condition is true you are guaranteed to be woken
up.
换了wait_event_interruptible()这个函数工作正常。但发现不用wake_up()函数也可以工作正常,不明白具体原因。感兴趣的分析一下,我前两篇转载的帖子。

阅读(1284) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~