- 论坛徽章:
- 0
|
求教wake_up_interruptible相关的问题!!!急
我在用户空间read一个设备,在这个设备的read函数中interruptible_sleep_on(&myirq_waitq);
当我按下按键,来外部中断IRQ15时,在中断服务程序中执行wake_up_interruptible(&myirq_waitq);
现在当产生外部中断时,程序一执行到wake_up_interruptible(&myirq_waitq)时就死机!
我的 内核是 2.4.18,用模块调试设备驱动程序.在模块中,已经在全局中DECLARE_WAIT_QUEUE_HEAD(myirq_waitq);
后来 我再中断服务程序中加了
if (waitqueue_active(&myirq_waitq)) wake_up_interruptible(&myirq_waitq)
不死机了
但是每次按下按键,都不执行wake_up_interruptible,用户程序一直睡眠,不能唤醒! 应该是进程未添加到等待队列中。后来用在驱动中的read函数里加了
DECLARE_WAITQUEUE(wait,current);
if(flags==0){
add_wait_queue(&myirq_waitq,&wait);
current->state = TASK_INTERRUPTIBLE;
}代替interruptible_sleep_on(&myirq_waitq)
结果read调用没有阻塞,每次调用都不等待中断,直接返回-1,郁闷啊,困扰好长时间了!是不是真的和内核版本有关系呢,2.4.18不能用wake_up_interruptible吗? |
|