*参照元 [#d0a9d345]
#backlinks

*説明 [#rdc38b3a]
-パス: [[linux-2.6.33/include/linux/mutex.h]]

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


**参考 [#ld43aa47]


*実装 [#h88ea8c0]
 /*
  * Simple, straightforward mutexes with strict semantics:
  *
  * - only one task can hold the mutex at a time
  * - only the owner can unlock the mutex
  * - multiple unlocks are not permitted
  * - recursive locking is not permitted
  * - a mutex object must be initialized via the API
  * - a mutex object must not be initialized via memset or copying
  * - task may not exit with mutex held
  * - memory areas where held locks reside must not be freed
  * - held mutexes must not be reinitialized
  * - mutexes may not be used in hardware or software interrupt
  *   contexts such as tasklets and timers
  *
  * These semantics are fully enforced when DEBUG_MUTEXES is
  * enabled. Furthermore, besides enforcing the above rules, the mutex
  * debugging code also implements a number of additional features
  * that make lock debugging easier and faster:
  *
  * - uses symbolic names of mutexes, whenever they are printed in debug output
  * - point-of-acquire tracking, symbolic lookup of function names
  * - list of all locks held in the system, printout of them
  * - owner tracking
  * - detects self-recursing locks and prints out all relevant info
  * - detects multi-task circular deadlocks and prints out all affected
  *   locks and tasks (and only those tasks)
  */
 struct mutex {
 	/* 1: unlocked, 0: locked, negative: locked, possible waiters */
 	atomic_t		count;
-
--[[linux-2.6.33/atomic_t]]

 	spinlock_t		wait_lock;
-
--[[linux-2.6.33/spinlock_t]]

 	struct list_head	wait_list;
-
--[[linux-2.6.33/list_head]]

 #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
-
--[[linux-2.6.33/CONFIG_DEBUG_MUTEXES]]
--[[linux-2.6.33/CONFIG_SMP]]

 	struct thread_info	*owner;
-
--[[linux-2.6.33/thread_info]]

 #endif
 #ifdef CONFIG_DEBUG_MUTEXES
-
--[[linux-2.6.33/CONFIG_DEBUG_MUTEXES]]

 	const char 		*name;
 	void			*magic;
 #endif
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
-
--[[linux-2.6.33/CONFIG_DEBUG_LOCK_ALLOC]]

 	struct lockdep_map	dep_map;
-
--[[linux-2.6.33/lockdep_map]]

 #endif
 };


*コメント [#z90d5c63]


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