summaryrefslogtreecommitdiff
path: root/src/pkg/os/exec.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/os/exec.go')
-rw-r--r--src/pkg/os/exec.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/pkg/os/exec.go b/src/pkg/os/exec.go
index 531b87ca5..5aea3098b 100644
--- a/src/pkg/os/exec.go
+++ b/src/pkg/os/exec.go
@@ -6,6 +6,7 @@ package os
import (
"runtime"
+ "sync/atomic"
"syscall"
)
@@ -13,7 +14,7 @@ import (
type Process struct {
Pid int
handle uintptr
- done bool // process has been successfully waited on
+ isdone uint32 // process has been successfully waited on, non zero if true
}
func newProcess(pid int, handle uintptr) *Process {
@@ -22,6 +23,14 @@ func newProcess(pid int, handle uintptr) *Process {
return p
}
+func (p *Process) setDone() {
+ atomic.StoreUint32(&p.isdone, 1)
+}
+
+func (p *Process) done() bool {
+ return atomic.LoadUint32(&p.isdone) > 0
+}
+
// ProcAttr holds the attributes that will be applied to a new process
// started by StartProcess.
type ProcAttr struct {
@@ -54,14 +63,6 @@ type Signal interface {
Signal() // to distinguish from other Stringers
}
-// The only signal values guaranteed to be present on all systems
-// are Interrupt (send the process an interrupt) and
-// Kill (force the process to exit).
-var (
- Interrupt Signal = syscall.SIGINT
- Kill Signal = syscall.SIGKILL
-)
-
// Getpid returns the process id of the caller.
func Getpid() int { return syscall.Getpid() }