blob: 6b251241a5fa43b7cfbcb89ef0b7d30ce2bc70ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifdef CONFIG_X86_32
# include "mutex_32.h"
#else
# include "mutex_64.h"
#endif
#ifndef __ASM_MUTEX_H
#define __ASM_MUTEX_H
#ifdef MUTEX_SHOULD_XCHG_COUNT
#undef MUTEX_SHOULD_XCHG_COUNT
#endif
/*
* For the x86 architecture, it allows any negative number (besides -1) in
* the mutex counter to indicate that some other threads are waiting on the
* mutex. So the atomic_xchg() function should not be called in
* __mutex_lock_common() if the value of the counter has already been set
* to a negative number.
*/
#define MUTEX_SHOULD_XCHG_COUNT(mutex) (atomic_read(&(mutex)->count) >= 0)
#endif
|