mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 09:18:31 +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
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/thread/itimer.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/thread/posixthread.internal.h"
|
||||
|
||||
struct IntervalTimer __itimer = {
|
||||
.lock = PTHREAD_MUTEX_INITIALIZER,
|
||||
|
@ -25,18 +26,18 @@ struct IntervalTimer __itimer = {
|
|||
};
|
||||
|
||||
textwindows void __itimer_lock(void) {
|
||||
pthread_mutex_lock(&__itimer.lock);
|
||||
_pthread_mutex_lock(&__itimer.lock);
|
||||
}
|
||||
|
||||
textwindows void __itimer_unlock(void) {
|
||||
pthread_mutex_unlock(&__itimer.lock);
|
||||
_pthread_mutex_unlock(&__itimer.lock);
|
||||
}
|
||||
|
||||
textwindows void __itimer_wipe_and_reset(void) {
|
||||
// timers aren't inherited by forked subprocesses
|
||||
bzero(&__itimer.it, sizeof(__itimer.it));
|
||||
pthread_mutex_wipe_np(&__itimer.lock);
|
||||
pthread_cond_init(&__itimer.cond, 0);
|
||||
_pthread_mutex_wipe_np(&__itimer.lock);
|
||||
bzero(&__itimer.cond, sizeof(__itimer.cond));
|
||||
__itimer.thread = 0;
|
||||
__itimer.once = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue