Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
@[has_globals]
module os
// g_v_os_execute_mutex_storage backs a pthread_mutex_t used to serialize
// pipe()+spawn from os.execute(). On macOS arm64 GitHub Actions runners,
// two threads racing through pipe()+posix_spawn produced empty captured
// output even with FD_CLOEXEC on the pipe ends. 128 bytes is comfortably
// larger than sizeof(pthread_mutex_t) on macOS (64) and Linux (40-48),
// so we never need to know the actual layout — only the C functions
// declared in builtin/cfns.c.v which take voidptr.
__global g_v_os_execute_mutex_storage = [128]u8{}
fn v_os_execute_mutex_ptr() voidptr {
return unsafe { voidptr(&g_v_os_execute_mutex_storage[0]) }
}
fn init() {
C.pthread_mutex_init(v_os_execute_mutex_ptr(), unsafe { nil })
}
fn v_os_execute_lock() {
C.pthread_mutex_lock(v_os_execute_mutex_ptr())
}
fn v_os_execute_unlock() {
C.pthread_mutex_unlock(v_os_execute_mutex_ptr())
}