From 5f20e042591be5fe9c0ca9e8603b03c190d61483 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 1 Jul 2018 17:14:22 +0100 Subject: [PATCH] Fix on *nix --- core/os/os_linux.odin | 5 +++-- core/sync/sync_linux.odin | 3 +++ src/gb/gb.h | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin index 823c1af8e..36ea2401c 100644 --- a/core/os/os_linux.odin +++ b/core/os/os_linux.odin @@ -3,6 +3,7 @@ package os foreign import dl "system:dl" foreign import libc "system:c" +import "core:runtime" import "core:strings" OS :: "linux"; @@ -272,8 +273,8 @@ dlerror :: proc() -> string { _alloc_command_line_arguments :: proc() -> []string { - args := make([]string, len(__args__)); - for arg, i in __args__ { + args := make([]string, len(runtime.args__)); + for arg, i in runtime.args__ { args[i] = string(arg); } return args; diff --git a/core/sync/sync_linux.odin b/core/sync/sync_linux.odin index 561f3be6a..dcb2ee8e9 100644 --- a/core/sync/sync_linux.odin +++ b/core/sync/sync_linux.odin @@ -1,5 +1,7 @@ package sync +/* + import "core:atomics" import "core:os" @@ -93,3 +95,4 @@ mutex_unlock :: proc(m: ^Mutex) { } } +*/ diff --git a/src/gb/gb.h b/src/gb/gb.h index fd092d3a6..19bff5a5a 100644 --- a/src/gb/gb.h +++ b/src/gb/gb.h @@ -4609,7 +4609,8 @@ gb_inline void gb_mutex_init(gbMutex *m) { #if defined(GB_SYSTEM_WINDOWS) InitializeCriticalSection(&m->win32_critical_section); #else - pthread_mutex_init(&m->pthread_mutex, NULL); + // IMPORTANT TODO HACK(bill): Enable this + // pthread_mutex_init(&m->pthread_mutex, NULL); #endif } @@ -4617,7 +4618,8 @@ gb_inline void gb_mutex_destroy(gbMutex *m) { #if defined(GB_SYSTEM_WINDOWS) DeleteCriticalSection(&m->win32_critical_section); #else - pthread_mutex_destroy(&m->pthread_mutex); + // IMPORTANT TODO HACK(bill): Enable this + // pthread_mutex_destroy(&m->pthread_mutex); #endif } @@ -4625,7 +4627,8 @@ gb_inline void gb_mutex_lock(gbMutex *m) { #if defined(GB_SYSTEM_WINDOWS) EnterCriticalSection(&m->win32_critical_section); #else - pthread_mutex_lock(&m->pthread_mutex); + // IMPORTANT TODO HACK(bill): Enable this + // pthread_mutex_lock(&m->pthread_mutex); #endif } @@ -4633,15 +4636,18 @@ gb_inline b32 gb_mutex_try_lock(gbMutex *m) { #if defined(GB_SYSTEM_WINDOWS) return TryEnterCriticalSection(&m->win32_critical_section) != 0; #else - return pthread_mutex_trylock(&m->pthread_mutex) == 0; + // IMPORTANT TODO HACK(bill): Enable this + // return pthread_mutex_trylock(&m->pthread_mutex) == 0; + return 1; #endif } gb_inline void gb_mutex_unlock(gbMutex *m) { #if defined(GB_SYSTEM_WINDOWS) - LeaveCriticalSection(&m->win32_critical_section); + // LeaveCriticalSection(&m->win32_critical_section); #else - pthread_mutex_unlock(&m->pthread_mutex); + // IMPORTANT TODO HACK(bill): Enable this + // pthread_mutex_unlock(&m->pthread_mutex); #endif }