[core:thread] Added self_cleanup flag to properly auto-clean threads

This commit is contained in:
hikari
2023-06-07 19:11:16 +03:00
parent 7dc09ed450
commit dcf4e51787
4 changed files with 41 additions and 102 deletions
+6
View File
@@ -47,6 +47,12 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
intrinsics.atomic_store(&t.flags, t.flags + {.Done})
if t.self_cleanup {
win32.CloseHandle(t.win32_thread)
t.win32_thread = win32.INVALID_HANDLE
free(t, t.creation_allocator)
}
return 0
}