*参照元 [#xb30cf01]
#backlinks

*説明 [#x327d7c6]
-パス: [[linux-2.6.33/kernel/semaphore.c]]

-FIXME: これは何?
--説明


**引数 [#te4f54b1]
-struct semaphore *sem
--
--[[linux-2.6.33/semaphore]]
-long state
--
-long timeout
--


**返り値 [#h6832eb7]
-int
--


**参考 [#a53b1f1f]


*実装 [#e7d12105]
 /*
  * Because this function is inlined, the 'state' parameter will be
  * constant, and thus optimised away by the compiler.  Likewise the
  * 'timeout' parameter for the cases without timeouts.
  */
 static inline int __sched __down_common(struct semaphore *sem, long state,
 								long timeout)
 {
 	struct task_struct *task = current;
 	struct semaphore_waiter waiter;
 
-
--[[linux-2.6.33/task_struct]]
-
--[[linux-2.6.33/current(global)]]
-
--[[linux-2.6.33/semaphore_waiter]]

 	list_add_tail(&waiter.list, &sem->wait_list);
 	waiter.task = task;
 	waiter.up = 0;
 
-
--[[linux-2.6.33/list_add_tail()]]

 	for (;;) {
 		if (signal_pending_state(state, task))
 			goto interrupted;
-
--[[linux-2.6.33/signal_pending_state()]]

 		if (timeout <= 0)
 			goto timed_out;
 		__set_task_state(task, state);
-
--[[linux-2.6.33/__set_task_state()]]

 		spin_unlock_irq(&sem->lock);
-
--[[linux-2.6.33/spin_unlock_irq()]]

 		timeout = schedule_timeout(timeout);
-
--[[linux-2.6.33/schedule_timeout()]]

 		spin_lock_irq(&sem->lock);
 		if (waiter.up)
 			return 0;
-
--[[linux-2.6.33/spin_lock_irq()]]

 	}
 
  timed_out:
 	list_del(&waiter.list);
 	return -ETIME;
 
-
--[[linux-2.6.33/list_del()]]
-
--[[linux-2.6.33/ETIME]]

  interrupted:
 	list_del(&waiter.list);
 	return -EINTR;
-
--[[linux-2.6.33/EINTR]]

 }


*コメント [#e77fc084]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS