Merge remote-tracking branch 'offical/master'

This commit is contained in:
2024-05-14 06:17:25 -04:00
23 changed files with 336 additions and 57 deletions
+2 -2
View File
@@ -137,8 +137,8 @@ IP4_Address :: distinct [4]u8
IP6_Address :: distinct [8]u16be
Address :: union {IP4_Address, IP6_Address}
IP4_Loopback := IP4_Address{127, 0, 0, 1}
IP6_Loopback := IP6_Address{0, 0, 0, 0, 0, 0, 0, 1}
IP4_Loopback :: IP4_Address{127, 0, 0, 1}
IP6_Loopback :: IP6_Address{0, 0, 0, 0, 0, 0, 0, 1}
IP4_Any := IP4_Address{}
IP6_Any := IP6_Address{}
+1 -1
View File
@@ -1,7 +1,7 @@
//+build i386, amd64
package simd_x86
import "core:intrinsics"
import "base:intrinsics"
@(require_results, enable_target_feature="lzcnt")
_lzcnt_u32 :: #force_inline proc "c" (x: u32) -> u32 {
+1 -1
View File
@@ -1,7 +1,7 @@
//+build amd64
package simd_x86
import "core:intrinsics"
import "base:intrinsics"
cmpxchg16b :: #force_inline proc "c" (dst: ^u128, old, new: u128, $success, $failure: intrinsics.Atomic_Memory_Order) -> (val: u128) {
return intrinsics.atomic_compare_exchange_strong_explicit(dst, old, new, success, failure)
+1 -1
View File
@@ -1,7 +1,7 @@
//+build i386, amd64
package simd_x86
import "core:intrinsics"
import "base:intrinsics"
import "core:simd"
// _MM_SHUFFLE(z, y, x, w) -> (z<<6 | y<<4 | x<<2 | w)
+1 -1
View File
@@ -1,7 +1,7 @@
//+build i386, amd64
package simd_x86
import "core:intrinsics"
import "base:intrinsics"
import "core:simd"
@(enable_target_feature="sse2")
+1 -1
View File
@@ -1,7 +1,7 @@
//+build i386, amd64
package simd_x86
import "core:intrinsics"
import "base:intrinsics"
import "core:simd"
@(require_results, enable_target_feature="sse3")
+1 -1
View File
@@ -1,7 +1,7 @@
//+build i386, amd64
package simd_x86
import "core:intrinsics"
import "base:intrinsics"
import "core:simd"
_ :: simd
+9
View File
@@ -36,6 +36,10 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
sync.wait(&t.cond, &t.mutex)
}
if .Joined in t.flags {
return nil
}
when ODIN_OS != .Darwin {
// Enable thread's cancelability.
if can_set_thread_cancel_state {
@@ -143,6 +147,11 @@ _join :: proc(t: ^Thread) {
if res, ok := CAS(&t.flags, unjoined, joined); res == joined && !ok {
return
}
// Prevent non-started threads from blocking main thread with initial wait
// condition.
if .Started not_in unjoined {
_start(t)
}
unix.pthread_join(t.unix_thread, nil)
}
+11 -2
View File
@@ -24,6 +24,10 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
__windows_thread_entry_proc :: proc "system" (t_: rawptr) -> win32.DWORD {
t := (^Thread)(t_)
if .Joined in t.flags {
return 0
}
t.id = sync.current_thread_id()
{
@@ -93,11 +97,16 @@ _join :: proc(t: ^Thread) {
return
}
t.flags += {.Joined}
if .Started not_in t.flags {
t.flags += {.Started}
win32.ResumeThread(t.win32_thread)
}
win32.WaitForSingleObject(t.win32_thread, win32.INFINITE)
win32.CloseHandle(t.win32_thread)
t.win32_thread = win32.INVALID_HANDLE
t.flags += {.Joined}
}
_join_multiple :: proc(threads: ..^Thread) {