HasTerminated checks if process has terminated. This is a function because terminated state can be subject to race conditions so we need a mutex to make the state thread safe.
()
| 157 | // This is a function because terminated state can be subject to race conditions |
| 158 | // so we need a mutex to make the state thread safe. |
| 159 | func (p *Process) HasTerminated() (state bool) { |
| 160 | p.hasTerminatedM.Lock() |
| 161 | state = p.hasTerminatedV |
| 162 | p.hasTerminatedM.Unlock() |
| 163 | return |
| 164 | } |
| 165 | |
| 166 | // HasCancelled is a wrapper function around context because it's a pretty ugly API |
| 167 | func (p *Process) HasCancelled() bool { |