mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Make fork() go 30% faster
This change makes fork() go nearly as fast as sys_fork() on UNIX. As for Windows this change shaves about 4-5ms off fork() + wait() latency. This is accomplished by using WriteProcessMemory() from the parent process to setup the address space of a suspended process; it is better than a pipe
This commit is contained in:
parent
98c5847727
commit
0b3c81dd4e
44 changed files with 769 additions and 649 deletions
|
@ -19,7 +19,7 @@
|
|||
#include "libc/thread/posixthread.internal.h"
|
||||
#include "third_party/tz/lock.h"
|
||||
|
||||
pthread_mutex_t __localtime_lock_obj = PTHREAD_MUTEX_INITIALIZER;
|
||||
static pthread_mutex_t __localtime_lock_obj = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
void __localtime_lock(void) {
|
||||
_pthread_mutex_lock(&__localtime_lock_obj);
|
||||
|
@ -28,3 +28,7 @@ void __localtime_lock(void) {
|
|||
void __localtime_unlock(void) {
|
||||
_pthread_mutex_unlock(&__localtime_lock_obj);
|
||||
}
|
||||
|
||||
void __localtime_wipe(void) {
|
||||
_pthread_mutex_wipe_np(&__localtime_lock_obj);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue