sync.yield_processor -> sync.cpu_relax; have it call intrinsics.cpu_relax
This commit is contained in:
1 parent
2c91c21021
commit
8dd1b61aa2
2 files changed
+7
-5
No files matched your search
@@ -2,6 +2,7 @@
|
||||
package thread;
|
||||
|
||||
import "core:runtime"
|
||||
import "core:intrinsics"
|
||||
import "core:sync"
|
||||
import "core:sys/unix"
|
||||
|
||||
@@ -134,7 +135,7 @@ join :: proc(t: ^Thread) {
|
||||
if sync.atomic_swap(&t.already_joined, true, .Sequentially_Consistent) {
|
||||
for {
|
||||
if sync.atomic_load(&t.done, .Sequentially_Consistent) do return;
|
||||
sync.yield_processor();
|
||||
intrinsics.cpu_relax();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user