wait_event_interruptible_timeout和schedule_timeout的区别
来源:互联网 发布:阿里云邮箱登陆客户端 编辑:程序博客网 时间:2024/05/22 01:32
http://blog.csdn.net/dahailinan/article/details/7469536
一、适用情况
wait_event_interruptible_timeout和schedule_timeout的区别当在某个硬件驱动程序中使用wait_event_interruptible_timeout时,执行的继续可以通过以下两种方式获得:
1.其他人在等待队列上调用了wake_up
2.超时到期。
而调用schedule_timeout的进程始终会在超时到期时被唤醒。
二、函数原型
wait_event_interruptible_timeout(queue, condition, timeout)
返回值:
大于零:剩余时间(以jiffy计)
零:给定的时间到期。
signed long schedule_timeout(signed long timeout);
返回值:
零:正常返回值
大于零:函数提前返回(比如响应某个信号),返回值为剩余时间
三、使用实例
1.wait_event_interrruptible_timeout
(1)初始化等待队列
int flags = 0;
wait_queue_head_t select_wait;
init_waitqueue_head(&select_wait);
(2)等待事件的发生(条件满足)
{
...
wait_event_interruptible_timeout(select_wait, flags != 0, HZ/10);
...
}
(3)唤醒等待队列
{
...
if(waitqueue_active(&select_wait))
{
flags = 1;
wake_up_interruptible( &nd->select_in_wait );
}
...
}
0 0
- wait_event_interruptible_timeout和schedule_timeout的区别
- wait_event_interruptible_timeout和schedule_timeout的区别
- wait_event_interruptible_timeout和schedule_timeout的区别
- wait_event_interruptible_timeout和schedule_timeout区别
- schedule_timeout的相关介绍
- schedule_timeout()
- schedule_timeout
- 关于schedule_timeout
- 关于schedule_timeout
- 关于schedule_timeout
- 内核sleep schedule_timeout
- linux内核--wait_event_interruptible_timeout()函数分析
- 内核定时器,schedule_timeout, ,POSIX timer
- 和和的区别
- & 和 &&、|和||的区别:
- &和&&、|和||的区别
- &&和&,||和|的区别
- &和&&、|和||的区别
- Wow! Such Doge!(同样没有输入结束标志的坑题)
- 揭秘腾讯burberry活动页面中的特效
- bug cocos2d-x 3.1 Node::sortAllChildren
- Log4j 生成日志文件(路径)
- Linux strace命令使用详解
- wait_event_interruptible_timeout和schedule_timeout的区别
- swift
- Binary Tree Preorder Traversal
- POJ 2676 数独(基础搜索)
- ttl 232 485
- 在虚拟环境中运行SQL Server
- sqlserver、mysql如何获取连接字符串
- linux下创建和删除软、硬链接
- 谈索引使用的误区