summaryrefslogtreecommitdiffstats
path: root/debian/htdig/htdig-3.2.0b6/db/x86.gcc
blob: 1009162a8683e72b5fb0cd0c2f71ed57ff583347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * @(#)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)