You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
424 B
18 lines
424 B
3 years ago
|
/*
|
||
|
* @(#)x86.gcc 11.1 (Sleepycat) 7/25/99
|
||
|
*
|
||
|
* For gcc/x86, 0 is clear, 1 is set.
|
||
|
*/
|
||
|
#define MUTEX_SET(tsl) ({ \
|
||
|
register tsl_t *__l = (tsl); \
|
||
|
int __r; \
|
||
|
asm volatile("movl $1,%%eax; lock; xchgb %1,%%al; xorl $1,%%eax"\
|
||
|
: "=&a" (__r), "=m" (*__l) \
|
||
|
: "1" (*__l) \
|
||
|
); \
|
||
|
__r & 1; \
|
||
|
})
|
||
|
|
||
|
#define MUTEX_UNSET(tsl) (*(tsl) = 0)
|
||
|
#define MUTEX_INIT(tsl) MUTEX_UNSET(tsl)
|