mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 14:18:47 +00:00
Use or_else in the core library when it makes sense
This commit is contained in:
@@ -38,8 +38,6 @@ Thread_Os_Specific :: struct #align 16 {
|
||||
//
|
||||
_create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^Thread {
|
||||
__linux_thread_entry_proc :: proc "c" (t: rawptr) -> rawptr {
|
||||
context = runtime.default_context();
|
||||
|
||||
t := (^Thread)(t);
|
||||
sync.condition_wait_for(&t.start_gate);
|
||||
sync.condition_destroy(&t.start_gate);
|
||||
@@ -47,11 +45,7 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^
|
||||
t.start_gate = {};
|
||||
t.start_mutex = {};
|
||||
|
||||
c := context;
|
||||
if ic, ok := t.init_context.?; ok {
|
||||
c = ic;
|
||||
}
|
||||
context = c;
|
||||
context = or_else(t.init_context.?, runtime.default_context());
|
||||
|
||||
t.procedure(t);
|
||||
|
||||
|
||||
@@ -23,12 +23,7 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^
|
||||
|
||||
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD {
|
||||
t := (^Thread)(t_);
|
||||
context = runtime.default_context();
|
||||
c := context;
|
||||
if ic, ok := t.init_context.?; ok {
|
||||
c = ic;
|
||||
}
|
||||
context = c;
|
||||
context = or_else(t.init_context.?, runtime.default_context());
|
||||
|
||||
t.procedure(t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user