mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Fix on *nix
This commit is contained in:
@@ -3,6 +3,7 @@ package os
|
|||||||
foreign import dl "system:dl"
|
foreign import dl "system:dl"
|
||||||
foreign import libc "system:c"
|
foreign import libc "system:c"
|
||||||
|
|
||||||
|
import "core:runtime"
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
|
|
||||||
OS :: "linux";
|
OS :: "linux";
|
||||||
@@ -272,8 +273,8 @@ dlerror :: proc() -> string {
|
|||||||
|
|
||||||
|
|
||||||
_alloc_command_line_arguments :: proc() -> []string {
|
_alloc_command_line_arguments :: proc() -> []string {
|
||||||
args := make([]string, len(__args__));
|
args := make([]string, len(runtime.args__));
|
||||||
for arg, i in __args__ {
|
for arg, i in runtime.args__ {
|
||||||
args[i] = string(arg);
|
args[i] = string(arg);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package sync
|
package sync
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
import "core:atomics"
|
import "core:atomics"
|
||||||
import "core:os"
|
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)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
InitializeCriticalSection(&m->win32_critical_section);
|
InitializeCriticalSection(&m->win32_critical_section);
|
||||||
#else
|
#else
|
||||||
pthread_mutex_init(&m->pthread_mutex, NULL);
|
// IMPORTANT TODO HACK(bill): Enable this
|
||||||
|
// pthread_mutex_init(&m->pthread_mutex, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4617,7 +4618,8 @@ gb_inline void gb_mutex_destroy(gbMutex *m) {
|
|||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
DeleteCriticalSection(&m->win32_critical_section);
|
DeleteCriticalSection(&m->win32_critical_section);
|
||||||
#else
|
#else
|
||||||
pthread_mutex_destroy(&m->pthread_mutex);
|
// IMPORTANT TODO HACK(bill): Enable this
|
||||||
|
// pthread_mutex_destroy(&m->pthread_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4625,7 +4627,8 @@ gb_inline void gb_mutex_lock(gbMutex *m) {
|
|||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
EnterCriticalSection(&m->win32_critical_section);
|
EnterCriticalSection(&m->win32_critical_section);
|
||||||
#else
|
#else
|
||||||
pthread_mutex_lock(&m->pthread_mutex);
|
// IMPORTANT TODO HACK(bill): Enable this
|
||||||
|
// pthread_mutex_lock(&m->pthread_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4633,15 +4636,18 @@ gb_inline b32 gb_mutex_try_lock(gbMutex *m) {
|
|||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
return TryEnterCriticalSection(&m->win32_critical_section) != 0;
|
return TryEnterCriticalSection(&m->win32_critical_section) != 0;
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gb_inline void gb_mutex_unlock(gbMutex *m) {
|
gb_inline void gb_mutex_unlock(gbMutex *m) {
|
||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
LeaveCriticalSection(&m->win32_critical_section);
|
// LeaveCriticalSection(&m->win32_critical_section);
|
||||||
#else
|
#else
|
||||||
pthread_mutex_unlock(&m->pthread_mutex);
|
// IMPORTANT TODO HACK(bill): Enable this
|
||||||
|
// pthread_mutex_unlock(&m->pthread_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user