*参照元 [#z72e185d] #backlinks *説明 [#wc4287ff] -パス: [[linux-2.6.33/kernel/wait.c]] -FIXME: これは何? --説明 **引数 [#jc0d7765] -wait_queue_head_t *q -- --[[linux-2.6.33/wait_queue_head_t]] -wait_queue_t *wait -- --[[linux-2.6.33/wait_queue_t]] -int state -- **返り値 [#le6c5978] -なし **参考 [#j9ab45fb] *実装 [#r2b6e78a] /* * Note: we use "set_current_state()" _after_ the wait-queue add, * because we need a memory barrier there on SMP, so that any * wake-function that tests for the wait-queue being active * will be guaranteed to see waitqueue addition _or_ subsequent * tests in this thread will see the wakeup having taken place. * * The spin_unlock() itself is semi-permeable and only protects * one way (it only protects stuff inside the critical region and * stops them from bleeding out - it would still allow subsequent * loads to move into the critical region). */ void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state) { unsigned long flags; wait->flags &= ~WQ_FLAG_EXCLUSIVE; - --[[linux-2.6.33/WQ_FLAG_EXCLUSIVE]] spin_lock_irqsave(&q->lock, flags); - --[[linux-2.6.33/spin_lock_irqsave()]] if (list_empty(&wait->task_list)) __add_wait_queue(q, wait); - --[[linux-2.6.33/list_empty()]] --[[linux-2.6.33/__add_wait_queue()]] set_current_state(state); - --[[linux-2.6.33/set_current_state()]] spin_unlock_irqrestore(&q->lock, flags); - --[[linux-2.6.33/spin_unlock_irqrestore()]] } EXPORT_SYMBOL(prepare_to_wait); -ライセンスに関係なくシンボルを公開する。 --[[linux-2.6.33/EXPORT_SYMBOL()]] *コメント [#t0e873f3]