Change-Id: Ia3213d22678be0d56bf4f34dfe458441f7f5da97
Reviewed-on: https://go-review.googlesource.com/c/go/+/426077
Run-TryBot: Michael Pratt <mpratt@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
type Process struct {
Pid int
handle uintptr // handle is accessed atomically on Windows
- isdone uint32 // process has been successfully waited on, non zero if true
+ isdone atomic.Bool // process has been successfully waited on
sigMu sync.RWMutex // avoid race between wait and signal
}
}
func (p *Process) setDone() {
- atomic.StoreUint32(&p.isdone, 1)
+ p.isdone.Store(true)
}
func (p *Process) done() bool {
- return atomic.LoadUint32(&p.isdone) > 0
+ return p.isdone.Load()
}
// ProcAttr holds the attributes that will be applied to a new process