Przeglądaj źródła

Merge pull request #5325 from Kelimion/fix-5321

Fix #5321
Jeroen van Rijn 2 miesięcy temu
rodzic
commit
b119ca0261
1 zmienionych plików z 6 dodań i 2 usunięć
  1. 6 2
      core/thread/thread_unix.odin

+ 6 - 2
core/thread/thread_unix.odin

@@ -27,8 +27,6 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
 		// 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
 
-		t.id = sync.current_thread_id()
-
 		if .Started not_in sync.atomic_load(&t.flags) {
 			sync.wait(&t.start_ok)
 		}
@@ -125,6 +123,12 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
 		return nil
 	}
 
+
+	when size_of(posix.pthread_t) == size_of(i64) {
+		thread.id = int((^i64)(&thread.unix_thread)^)
+	} else {
+		thread.id = int((^i32)(&thread.unix_thread)^)
+	}
 	return thread
 }