Add thread.run* shorthand procedures; Thread.init_context use new Maybe concept

This commit is contained in:
gingerBill
2020-06-22 13:28:37 +01:00
parent fb3aeccd36
commit b3c51a8b44
4 changed files with 60 additions and 22 deletions
+3 -3
View File
@@ -51,14 +51,14 @@ create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^T
t.start_gate = {};
c := context;
if t.use_init_context {
c = t.init_context;
if ic, ok := t.init_context.?; ok {
c = ic;
}
context = c;
t.procedure(t);
if !t.use_init_context {
if t.init_context == nil {
if context.temp_allocator.data == &runtime.global_default_temp_allocator_data {
runtime.default_temp_allocator_destroy(auto_cast context.temp_allocator.data);
}