if (inc_kids)
forEachKid([](Process *p) { p->suspend(true); });
- if (!_suspended) {
+ if (!_suspended && !_terminated) {
_suspended = true;
_suspendedReady = scheduler.suspend(this);
if (inc_kids)
forEachKid([](Process *p) { p->resume(true); });
- if (_suspended) {
+ if (_suspended && !_terminated) {
_suspended = false;
if (_suspendedReady)
scheduler.resume(this);
message.c_str());
}
- _disabled = true;
+ if (!_terminated)
+ _disabled = true;
}
void
if (inc_kids)
forEachKid([](Process *p) { p->enable(true); });
- _disabled = false;
+ if (!_terminated)
+ _disabled = false;
}
void
if (inc_kids)
forEachKid([](Process *p) { p->kill(true); });
- // If we're in the middle of unwinding, ignore the kill request.
- if (_isUnwinding)
+ // If we're unwinding or terminated, ignore the kill request.
+ if (_isUnwinding || _terminated)
return;
// Update our state.
if (inc_kids)
forEachKid([](Process *p) { p->reset(true); });
- // If we're in the middle of unwinding, ignore the reset request.
- if (_isUnwinding)
+ // If we're already unwinding or terminated, ignore the reset request.
+ if (_isUnwinding || _terminated)
return;
// Clear suspended ready since we're about to run regardless.