参照元

説明

引数

返り値

参考

実装

汎用: 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

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2014-09-13 (土) 08:26:40