Add missing lock to fork() on Windows

This commit is contained in:
Justine Tunney 2025-01-03 19:01:58 -08:00
parent e939659b70
commit fe01642a20
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
19 changed files with 90 additions and 96 deletions

View file

@ -37,7 +37,7 @@
#include "libc/nt/runtime.h"
#include "libc/nt/thread.h"
#include "libc/nt/thunk/msabi.h"
#include "libc/proc/proc.internal.h"
#include "libc/proc/proc.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/syslib.internal.h"
@ -119,6 +119,9 @@ static void fork_prepare(void) {
_weaken(__localtime_lock)();
if (_weaken(__dlopen_lock))
_weaken(__dlopen_lock)();
if (IsWindows())
if (_weaken(__proc_lock))
_weaken(__proc_lock)();
if (_weaken(cosmo_stack_lock))
_weaken(cosmo_stack_lock)();
__cxa_lock();
@ -151,6 +154,9 @@ static void fork_parent(void) {
__cxa_unlock();
if (_weaken(cosmo_stack_unlock))
_weaken(cosmo_stack_unlock)();
if (IsWindows())
if (_weaken(__proc_unlock))
_weaken(__proc_unlock)();
if (_weaken(__dlopen_unlock))
_weaken(__dlopen_unlock)();
if (_weaken(__localtime_unlock))