| ... | @@ -911,18 +911,9 @@ const WasiThreadImpl = struct { | ... | @@ -911,18 +911,9 @@ const WasiThreadImpl = struct { |
| 911 | allocator.free(self.thread.memory); | 911 | allocator.free(self.thread.memory); |
| 912 | } | 912 | } |
| 913 | | 913 | |
| 914 | var spin: u8 = 10; | | |
| 915 | while (true) { | 914 | while (true) { |
| 916 | const tid = self.thread.tid.load(.seq_cst); | 915 | const tid = self.thread.tid.load(.seq_cst); |
| 917 | if (tid == 0) { | 916 | if (tid == 0) break; |
| 918 | break; | | |
| 919 | } | | |
| 920 | | | |
| 921 | if (spin > 0) { | | |
| 922 | spin -= 1; | | |
| 923 | std.atomic.spinLoopHint(); | | |
| 924 | continue; | | |
| 925 | } | | |
| 926 | | 917 | |
| 927 | const result = asm ( | 918 | const result = asm ( |
| 928 | \\ local.get %[ptr] | 919 | \\ local.get %[ptr] |
| ... | @@ -1514,18 +1505,9 @@ const LinuxThreadImpl = struct { | ... | @@ -1514,18 +1505,9 @@ const LinuxThreadImpl = struct { |
| 1514 | fn join(self: Impl) void { | 1505 | fn join(self: Impl) void { |
| 1515 | defer posix.munmap(self.thread.mapped); | 1506 | defer posix.munmap(self.thread.mapped); |
| 1516 | | 1507 | |
| 1517 | var spin: u8 = 10; | | |
| 1518 | while (true) { | 1508 | while (true) { |
| 1519 | const tid = self.thread.child_tid.load(.seq_cst); | 1509 | const tid = self.thread.child_tid.load(.seq_cst); |
| 1520 | if (tid == 0) { | 1510 | if (tid == 0) break; |
| 1521 | break; | | |
| 1522 | } | | |
| 1523 | | | |
| 1524 | if (spin > 0) { | | |
| 1525 | spin -= 1; | | |
| 1526 | std.atomic.spinLoopHint(); | | |
| 1527 | continue; | | |
| 1528 | } | | |
| 1529 | | 1511 | |
| 1530 | switch (linux.E.init(linux.futex_4arg( | 1512 | switch (linux.E.init(linux.futex_4arg( |
| 1531 | &self.thread.child_tid.raw, | 1513 | &self.thread.child_tid.raw, |
| ... | @@ -1616,7 +1598,6 @@ test "setName, getName" { | ... | @@ -1616,7 +1598,6 @@ test "setName, getName" { |
| 1616 | } | 1598 | } |
| 1617 | | 1599 | |
| 1618 | test { | 1600 | test { |
| 1619 | // Doesn't use testing.refAllDecls() since that would pull in the compileError spinLoopHint. | | |
| 1620 | _ = Futex; | 1601 | _ = Futex; |
| 1621 | _ = ResetEvent; | 1602 | _ = ResetEvent; |
| 1622 | _ = Mutex; | 1603 | _ = Mutex; |