mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add posix semaphores support
There's still some bugs to work out on Windows and OpenBSD.
This commit is contained in:
parent
f52f65b2e3
commit
8111462789
36 changed files with 779 additions and 59 deletions
7
third_party/lua/lunix.c
vendored
7
third_party/lua/lunix.c
vendored
|
@ -2856,8 +2856,8 @@ static int LuaUnixMemoryWait(lua_State *L) {
|
|||
}
|
||||
deadline = &ts;
|
||||
}
|
||||
rc = nsync_futex_wait_((int *)GetWord(L), expect, PTHREAD_PROCESS_SHARED,
|
||||
deadline);
|
||||
rc = nsync_futex_wait_((atomic_int *)GetWord(L), expect,
|
||||
PTHREAD_PROCESS_SHARED, deadline);
|
||||
if (rc < 0) errno = -rc, rc = -1;
|
||||
return SysretInteger(L, "futex_wait", olderr, rc);
|
||||
}
|
||||
|
@ -2867,7 +2867,8 @@ 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_((int *)GetWord(L), count, PTHREAD_PROCESS_SHARED);
|
||||
woken = nsync_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