mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-24 00:17:54 +00:00
Fix on *nix
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package sync
|
||||
|
||||
/*
|
||||
|
||||
import "core:atomics"
|
||||
import "core:os"
|
||||
|
||||
@@ -93,3 +95,4 @@ mutex_unlock :: proc(m: ^Mutex) {
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
+12
-6
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user