diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-12-13 10:37:24 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-12-16 01:58:33 +0100 |
commit | bec412424e949c900b01767ce32b6743bdaaac93 (patch) | |
tree | d4244ee3b644f5e8e68dfb5f22aeeb30065bca75 /mach | |
parent | 18c2ab9a094f6a6cb3a107d66dafaf32f8f969f0 (diff) | |
download | glibc-bec412424e949c900b01767ce32b6743bdaaac93.tar.gz glibc-bec412424e949c900b01767ce32b6743bdaaac93.tar.xz glibc-bec412424e949c900b01767ce32b6743bdaaac93.zip |
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_*.
Diffstat (limited to 'mach')
-rw-r--r-- | mach/lock-intern.h | 6 | ||||
-rw-r--r-- | mach/lowlevellock.h | 24 |
2 files changed, 20 insertions, 10 deletions
diff --git a/mach/lock-intern.h b/mach/lock-intern.h index 62faf98039..77fc4d17f8 100644 --- a/mach/lock-intern.h +++ b/mach/lock-intern.h @@ -57,7 +57,7 @@ extern void __spin_lock (__spin_lock_t *__lock); _EXTERN_INLINE void __spin_lock (__spin_lock_t *__lock) { - lll_lock (__lock, 0); + __lll_lock (__lock, 0); } #endif @@ -68,7 +68,7 @@ extern void __spin_unlock (__spin_lock_t *__lock); _EXTERN_INLINE void __spin_unlock (__spin_lock_t *__lock) { - lll_unlock (__lock, 0); + __lll_unlock (__lock, 0); } #endif @@ -79,7 +79,7 @@ extern int __spin_try_lock (__spin_lock_t *__lock); _EXTERN_INLINE int __spin_try_lock (__spin_lock_t *__lock) { - return (lll_trylock (__lock) == 0); + return (__lll_trylock (__lock) == 0); } #endif diff --git a/mach/lowlevellock.h b/mach/lowlevellock.h index cf67ccd589..0a22a030b4 100644 --- a/mach/lowlevellock.h +++ b/mach/lowlevellock.h @@ -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 |