| ... | ... | @@ -497,7 +497,7 @@ const LinuxThreadImpl = struct { |
| 497 | 497 | |
| 498 | 498 | const ThreadCompletion = struct { |
| 499 | 499 | completion: Completion = Completion.init(.running), |
| 500 | | child_tid: Atomic(i32) = Atomic(i32).init(0), |
| 500 | child_tid: Atomic(i32) = Atomic(i32).init(1), |
| 501 | 501 | parent_tid: i32 = undefined, |
| 502 | 502 | mapped: []align(std.mem.page_size) u8, |
| 503 | 503 | }; |
| ... | ... | @@ -510,7 +510,7 @@ const LinuxThreadImpl = struct { |
| 510 | 510 | |
| 511 | 511 | fn entryFn(raw_arg: usize) callconv(.C) u8 { |
| 512 | 512 | const self = @intToPtr(*@This(), raw_arg); |
| 513 | | defer switch (self.thread.completion.swap(.completed, .Acquire)) { |
| 513 | defer switch (self.thread.completion.swap(.completed, .SeqCst)) { |
| 514 | 514 | .running => {}, |
| 515 | 515 | .completed => unreachable, |
| 516 | 516 | .detached => { |
| ... | ... | @@ -600,8 +600,8 @@ const LinuxThreadImpl = struct { |
| 600 | 600 | |
| 601 | 601 | const flags: u32 = os.CLONE_THREAD | os.CLONE_DETACHED | |
| 602 | 602 | os.CLONE_VM | os.CLONE_FS | os.CLONE_FILES | |
| 603 | | os.CLONE_SIGHAND | os.CLONE_SYSVSEM | os.CLONE_SETTLS | |
| 604 | | os.CLONE_PARENT_SETTID | os.CLONE_CHILD_SETTID | os.CLONE_CHILD_CLEARTID; |
| 603 | os.CLONE_PARENT_SETTID | os.CLONE_CHILD_CLEARTID | |
| 604 | os.CLONE_SIGHAND | os.CLONE_SYSVSEM | os.CLONE_SETTLS; |
| 605 | 605 | |
| 606 | 606 | switch (linux.getErrno(linux.clone( |
| 607 | 607 | Instance.entryFn, |
| ... | ... | @@ -628,7 +628,7 @@ const LinuxThreadImpl = struct { |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | fn detach(self: Impl) void { |
| 631 | | switch (self.thread.completion.swap(.detached, .AcqRel)) { |
| 631 | switch (self.thread.completion.swap(.detached, .SeqCst)) { |
| 632 | 632 | .running => {}, |
| 633 | 633 | .completed => self.join(), |
| 634 | 634 | .detached => unreachable, |
| ... | ... | @@ -640,7 +640,7 @@ const LinuxThreadImpl = struct { |
| 640 | 640 | |
| 641 | 641 | var spin: u8 = 10; |
| 642 | 642 | while (true) { |
| 643 | | const tid = self.thread.child_tid.load(.Acquire); |
| 643 | const tid = self.thread.child_tid.load(.SeqCst); |
| 644 | 644 | if (tid == 0) { |
| 645 | 645 | break; |
| 646 | 646 | } |