mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Fix #5321
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
package thread
|
package thread
|
||||||
|
|
||||||
import "base:runtime"
|
import "base:runtime"
|
||||||
|
import "core:c"
|
||||||
import "core:sync"
|
import "core:sync"
|
||||||
import "core:sys/posix"
|
import "core:sys/posix"
|
||||||
|
|
||||||
@@ -27,8 +28,6 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
|||||||
// most of the time, don't ask me why.
|
// most of the time, don't ask me why.
|
||||||
can_set_thread_cancel_state := posix.pthread_setcancelstate(.DISABLE when ODIN_OS == .Darwin else .ENABLE, nil) == nil
|
can_set_thread_cancel_state := posix.pthread_setcancelstate(.DISABLE when ODIN_OS == .Darwin else .ENABLE, nil) == nil
|
||||||
|
|
||||||
t.id = sync.current_thread_id()
|
|
||||||
|
|
||||||
if .Started not_in sync.atomic_load(&t.flags) {
|
if .Started not_in sync.atomic_load(&t.flags) {
|
||||||
sync.wait(&t.start_ok)
|
sync.wait(&t.start_ok)
|
||||||
}
|
}
|
||||||
@@ -125,6 +124,12 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
when size_of(posix.pthread_t) == size_of(i64) {
|
||||||
|
thread.id = int(transmute(i64)thread.unix_thread)
|
||||||
|
} else {
|
||||||
|
thread.id = int(transmute(i32)thread.unix_thread)
|
||||||
|
}
|
||||||
return thread
|
return thread
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user