mirror of
https://github.com/fluencelabs/musl
synced 2025-06-27 21:52:02 +00:00
replace __wake function with macro that performs direct syscall
this should generate faster and smaller code, especially with inline syscalls. the conditional with cnt is ugly, but thankfully cnt is always a constant anyway so it gets evaluated at compile time. it may be preferable to make separate __wake and __wakeall macros without a count argument. priv flag is not used yet; private futex support still needs to be done at some point in the future.
This commit is contained in:
@ -106,7 +106,8 @@ void __unmapself(void *, size_t);
|
|||||||
|
|
||||||
int __timedwait(volatile int *, int, clockid_t, const struct timespec *, void (*)(void *), void *, int);
|
int __timedwait(volatile int *, int, clockid_t, const struct timespec *, void (*)(void *), void *, int);
|
||||||
void __wait(volatile int *, volatile int *, int, int);
|
void __wait(volatile int *, volatile int *, int, int);
|
||||||
void __wake(volatile int *, int, int);
|
#define __wake(addr, cnt, priv) \
|
||||||
|
__syscall(SYS_futex, addr, FUTEX_WAKE, (cnt)<0?INT_MAX:(cnt))
|
||||||
|
|
||||||
void __acquire_ptc();
|
void __acquire_ptc();
|
||||||
void __release_ptc();
|
void __release_ptc();
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#include "pthread_impl.h"
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
void __wake(volatile int *addr, int cnt, int priv)
|
|
||||||
{
|
|
||||||
if (priv) priv = 128; priv=0;
|
|
||||||
if (cnt<0) cnt = INT_MAX;
|
|
||||||
__syscall(SYS_futex, (long)addr, FUTEX_WAKE | priv, cnt);
|
|
||||||
}
|
|
Reference in New Issue
Block a user