喜欢coding,因为那是一件伟大的事情,是将无生命的IC赋予灵魂的过程,让我拥有了和上帝一样的成就感。(w1c2g3@163.com)
全部博文(60)
分类: LINUX
2013-09-21 20:51:04
wait_event(wq, condition) / wait_event_interruptible
2. wake_up ->
prepare_to_wait
schedule_timeoutfinish_wait
DECLARE_WAITQUEUE(wait, current);add_wait_queue(&pDrvData->IPCs[ipcnum].ipc_wait_queue, &wait);set_current_state(TASK_INTERRUPTIBLE);schedule();remove_wait_queue(&pDrvData->IPCs[ipcnum].ipc_wait_queue, &wait);set_current_state(TASK_RUNNING);
poll_wait
wait_queue_t wait = {
.private = current,.func = default_wake_function,.task_list = { NULL, NULL }
}
wait->flags &= ~WQ_FLAG_EXCLUSIVE;
spin_lock_irqsave(&q->lock, flags);
__add_wait_queue(q, wait); -> list_add(&new->task_list, &head->task_list);
spin_unlock_irqrestore(&q->lock, flags);
spin_lock_irqsave(&q->lock, flags);
__remove_wait_queue(q, wait); -> list_del(&old->task_list);
spin_unlock_irqrestore(&q->lock, flags);
struct poll_wqueues table;
poll_initwait -> poll_table._qproc = __pollwait
wait = &table.pt;
(*f_op->poll)(file, wait); // 2
poll_schedule_timeout -> to schedule
poll_wait -> p->_qproc -> __pollwait
wait_queue_t.func = pollwake
add_wait_queue
wake_up -> wait_queue_t.func -> pollwake -> __pollwake -> default_wake_function