mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-03 00:10:31 +00:00
Introduce cosmo_futex_wait and cosmo_futex_wake
Cosmopolitan Futexes are now exposed as a public API.
This commit is contained in:
parent
729f7045e3
commit
9ddbfd921e
66 changed files with 886 additions and 917 deletions
7
third_party/lua/lunix.c
vendored
7
third_party/lua/lunix.c
vendored
|
@ -109,8 +109,9 @@
|
|||
#include "third_party/lua/lgc.h"
|
||||
#include "third_party/lua/lua.h"
|
||||
#include "third_party/lua/luaconf.h"
|
||||
#include "third_party/nsync/futex.internal.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/cosmo.h"
|
||||
#include "libc/cosmo.h"
|
||||
#include "tool/net/luacheck.h"
|
||||
|
||||
#define DNS_NAME_MAX 253
|
||||
|
@ -2855,7 +2856,7 @@ static int LuaUnixMemoryWait(lua_State *L) {
|
|||
deadline = &ts;
|
||||
}
|
||||
BEGIN_CANCELATION_POINT;
|
||||
rc = nsync_futex_wait_((atomic_int *)GetWord(L), expect,
|
||||
rc = cosmo_futex_wait((atomic_int *)GetWord(L), expect,
|
||||
PTHREAD_PROCESS_SHARED, CLOCK_REALTIME, deadline);
|
||||
END_CANCELATION_POINT;
|
||||
if (rc < 0) errno = -rc, rc = -1;
|
||||
|
@ -2867,7 +2868,7 @@ static int LuaUnixMemoryWait(lua_State *L) {
|
|||
static int LuaUnixMemoryWake(lua_State *L) {
|
||||
int count, woken;
|
||||
count = luaL_optinteger(L, 3, INT_MAX);
|
||||
woken = nsync_futex_wake_((atomic_int *)GetWord(L), count,
|
||||
woken = cosmo_futex_wake((atomic_int *)GetWord(L), count,
|
||||
PTHREAD_PROCESS_SHARED);
|
||||
npassert(woken >= 0);
|
||||
return ReturnInteger(L, woken);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue