参照元†
- atomic_t *count
- int (*fail_fn)(atomic_t *)
返り値†
- 独自のミューテックスロック関数を定義しているアーキテクチャ
- ARM
- Blackfin
- IA64
- PowerPC
- SH
- x86(32bit)
- x86_64(64bit)
汎用: include/asm-generic/mutex-dec.h†
/**
* __mutex_fastpath_lock_retval - try to take the lock by moving the count
* from 1 to a 0 value
* @count: pointer of type atomic_t
* @fail_fn: function to call if the original value was not 1
*
* Change the count from 1 to a value lower than 1, and call <fail_fn> if
* it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
* or anything the slow path function returns.
*/
static inline int
__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
{
if (unlikely(atomic_dec_return(count) < 0))
return fail_fn(count);
return 0;
}
ARM 用 : arch/arm/include/asm/mutex.h†
Blackfin 用: arch/blackfin/include/asm/mutex.h†
IA64 用 : arch/ia64/include/asm/mutex.h†
PowerPC 用 : arch/powerpc/include/asm/mutex.h†
SH 用 : arch/sh/include/asm/mutex-llsc.h†
x86(32bit) 用 : arch/x86/include/asm/mutex_32.h†
x86_64(64bit) 用: arch/x86/include/asm/mutex_64.h†
コメント†