mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-26 14:28:30 +00:00
Allow user to override pthread mutex and cond
This commit is contained in:
parent
4705705548
commit
55b7aa1632
54 changed files with 216 additions and 102 deletions
|
@ -37,6 +37,7 @@
|
|||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
#include "libc/thread/posixthread.internal.h"
|
||||
#include "libc/thread/semaphore.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
|
@ -56,19 +57,18 @@ static struct Semaphores {
|
|||
};
|
||||
|
||||
static void sem_open_lock(void) {
|
||||
pthread_mutex_lock(&g_semaphores.lock);
|
||||
_pthread_mutex_lock(&g_semaphores.lock);
|
||||
}
|
||||
|
||||
static void sem_open_unlock(void) {
|
||||
pthread_mutex_unlock(&g_semaphores.lock);
|
||||
_pthread_mutex_unlock(&g_semaphores.lock);
|
||||
}
|
||||
|
||||
static void sem_open_wipe(void) {
|
||||
pthread_mutex_init(&g_semaphores.lock, 0);
|
||||
_pthread_mutex_wipe_np(&g_semaphores.lock);
|
||||
}
|
||||
|
||||
static void sem_open_setup(void) {
|
||||
sem_open_wipe();
|
||||
pthread_atfork(sem_open_lock, sem_open_unlock, sem_open_wipe);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue