mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fix zombie thread leak in thread self cleanup
This commit is contained in:
@@ -27,6 +27,8 @@ foreign pthread {
|
|||||||
|
|
||||||
pthread_equal :: proc(a, b: pthread_t) -> b32 ---
|
pthread_equal :: proc(a, b: pthread_t) -> b32 ---
|
||||||
|
|
||||||
|
pthread_detach :: proc(t: pthread_t) -> c.int ---
|
||||||
|
|
||||||
sched_get_priority_min :: proc(policy: c.int) -> c.int ---
|
sched_get_priority_min :: proc(policy: c.int) -> c.int ---
|
||||||
sched_get_priority_max :: proc(policy: c.int) -> c.int ---
|
sched_get_priority_max :: proc(policy: c.int) -> c.int ---
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
|||||||
sync.unlock(&t.mutex)
|
sync.unlock(&t.mutex)
|
||||||
|
|
||||||
if .Self_Cleanup in sync.atomic_load(&t.flags) {
|
if .Self_Cleanup in sync.atomic_load(&t.flags) {
|
||||||
|
res := unix.pthread_detach(t.unix_thread)
|
||||||
|
assert_contextless(res == 0)
|
||||||
|
|
||||||
t.unix_thread = {}
|
t.unix_thread = {}
|
||||||
// NOTE(ftphikari): It doesn't matter which context 'free' received, right?
|
// NOTE(ftphikari): It doesn't matter which context 'free' received, right?
|
||||||
context = {}
|
context = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user