Make futexes cancellable by pthreads

This commit is contained in:
Justine Tunney 2022-11-04 18:19:05 -07:00
parent 2278327eba
commit 022536cab6
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
101 changed files with 627 additions and 391 deletions

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/calls/blockcancel.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/dce.h"
@ -195,6 +196,7 @@ sem_t *sem_open(const char *name, int oflag, ...) {
if (!(path = sem_path_np(name, pathbuf, sizeof(pathbuf)))) {
return SEM_FAILED;
}
BLOCK_CANCELLATIONS;
sem_open_init();
sem_open_lock();
if ((s = sem_open_reopen(path))) {
@ -233,6 +235,7 @@ sem_t *sem_open(const char *name, int oflag, ...) {
sem = SEM_FAILED;
}
sem_open_unlock();
ALLOW_CANCELLATIONS;
return sem;
}