Make recursive mutexes slightly faster

This commit is contained in:
Justine Tunney 2024-12-30 01:37:14 -08:00
parent 9ba5b227d9
commit c7e3d9f7ff
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 12 additions and 8 deletions

View file

@ -18,6 +18,7 @@
*/
#include "libc/assert.h"
#include "libc/atomic.h"
#include "libc/calls/cp.internal.h"
#include "libc/calls/internal.h"
#include "libc/calls/sig.internal.h"
#include "libc/calls/struct/sigset.h"
@ -232,6 +233,7 @@ static int cosmo_futex_fix_timeout (struct timespec *memory, int clock,
* @raise EAGAIN if `*w` wasn't `expect`
* @raise EINTR if a signal handler was called while waiting
* @raise ECANCELED if calling thread was canceled while waiting
* @cancelationpoint
*/
int cosmo_futex_wait (atomic_int *w, int expect, char pshare,
int clock, const struct timespec *abstime) {
@ -240,6 +242,7 @@ int cosmo_futex_wait (atomic_int *w, int expect, char pshare,
struct PosixThread *pt;
struct timespec tsmem;
struct timespec *timeout = 0;
BEGIN_CANCELATION_POINT;
cosmo_once (&g_cosmo_futex.once, cosmo_futex_init);
@ -351,6 +354,7 @@ Finished:
DescribeTimespec (0, abstime),
DescribeErrno (rc));
END_CANCELATION_POINT;
return rc;
}