mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
hurd: make lll_* take a variable instead of a ptr
To be coherent with other ports, let's make lll_* take a variable, and rename those that keep taking a ptr into __lll_*.
This commit is contained in:
@@ -36,16 +36,20 @@
|
||||
|
||||
/* Wait on address PTR, without blocking if its contents
|
||||
* are different from VAL. */
|
||||
#define lll_wait(ptr, val, flags) \
|
||||
#define __lll_wait(ptr, val, flags) \
|
||||
__gsync_wait (__mach_task_self (), \
|
||||
(vm_offset_t)(ptr), (val), 0, 0, (flags))
|
||||
#define lll_wait(var, val, flags) \
|
||||
__lll_wait (&(var), val, flags)
|
||||
|
||||
/* Wake one or more threads waiting on address PTR. */
|
||||
#define lll_wake(ptr, flags) \
|
||||
#define __lll_wake(ptr, flags) \
|
||||
__gsync_wake (__mach_task_self (), (vm_offset_t)(ptr), 0, (flags))
|
||||
#define lll_wake(var, flags) \
|
||||
__lll_wake (&(var), flags)
|
||||
|
||||
/* Acquire the lock at PTR. */
|
||||
#define lll_lock(ptr, flags) \
|
||||
#define __lll_lock(ptr, flags) \
|
||||
({ \
|
||||
int *__iptr = (int *)(ptr); \
|
||||
int __flags = (flags); \
|
||||
@@ -55,27 +59,33 @@
|
||||
{ \
|
||||
if (atomic_exchange_acq (__iptr, 2) == 0) \
|
||||
break; \
|
||||
lll_wait (__iptr, 2, __flags); \
|
||||
__lll_wait (__iptr, 2, __flags); \
|
||||
} \
|
||||
(void)0; \
|
||||
})
|
||||
#define lll_lock(var, flags) \
|
||||
__lll_lock (&(var), flags)
|
||||
|
||||
/* Try to acquire the lock at PTR, without blocking.
|
||||
Evaluates to zero on success. */
|
||||
#define lll_trylock(ptr) \
|
||||
#define __lll_trylock(ptr) \
|
||||
({ \
|
||||
int *__iptr = (int *)(ptr); \
|
||||
*__iptr == 0 \
|
||||
&& atomic_compare_and_exchange_bool_acq (__iptr, 1, 0) == 0 ? 0 : -1; \
|
||||
})
|
||||
#define lll_trylock(var) \
|
||||
__lll_trylock (&(var))
|
||||
|
||||
/* Release the lock at PTR. */
|
||||
#define lll_unlock(ptr, flags) \
|
||||
#define __lll_unlock(ptr, flags) \
|
||||
({ \
|
||||
int *__iptr = (int *)(ptr); \
|
||||
if (atomic_exchange_rel (__iptr, 0) == 2) \
|
||||
lll_wake (__iptr, (flags)); \
|
||||
__lll_wake (__iptr, (flags)); \
|
||||
(void)0; \
|
||||
})
|
||||
#define lll_unlock(var, flags) \
|
||||
__lll_unlock (&(var), flags)
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user