Skip to content

Commit caf41aa

Browse files
committed
1 parent ac5f374 commit caf41aa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/thread/thread_unix.odin

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package thread
44

55
import "base:runtime"
6+
import "core:c"
67
import "core:sync"
78
import "core:sys/posix"
89

@@ -27,8 +28,6 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
2728
// most of the time, don't ask me why.
2829
can_set_thread_cancel_state := posix.pthread_setcancelstate(.DISABLE when ODIN_OS == .Darwin else .ENABLE, nil) == nil
2930

30-
t.id = sync.current_thread_id()
31-
3231
if .Started not_in sync.atomic_load(&t.flags) {
3332
sync.wait(&t.start_ok)
3433
}
@@ -125,6 +124,12 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
125124
return nil
126125
}
127126

127+
128+
when size_of(posix.pthread_t) == size_of(i64) {
129+
thread.id = int(transmute(i64)thread.unix_thread)
130+
} else {
131+
thread.id = int(transmute(i32)thread.unix_thread)
132+
}
128133
return thread
129134
}
130135

0 commit comments

Comments
 (0)