mirror of
https://github.com/nukesor/pueue
synced 2024-09-29 20:44:03 +00:00
fix: Stack-overflow during shutdown
This commit is contained in:
parent
ec9e65664e
commit
7fc6fd244e
|
@ -17,9 +17,13 @@ pub mod start;
|
|||
/// We don't have to pause any groups, as no new tasks will be spawned during shutdown anyway.
|
||||
/// Any groups with queued tasks, will be automatically paused on state-restoration.
|
||||
pub fn initiate_shutdown(settings: &Settings, state: &mut LockedState, shutdown: Shutdown) {
|
||||
state.shutdown = Some(shutdown);
|
||||
|
||||
self::kill::kill(settings, state, TaskSelection::All, false, None);
|
||||
// Only start shutdown if we aren't already in one.
|
||||
// Otherwise, we might end up with an endless recursion as `kill` might fail and initiate shutdown
|
||||
// once again.
|
||||
if state.shutdown.is_none() {
|
||||
state.shutdown = Some(shutdown);
|
||||
self::kill::kill(settings, state, TaskSelection::All, false, None);
|
||||
}
|
||||
}
|
||||
|
||||
/// This is a small wrapper around the real platform dependant process handling logic
|
||||
|
|
Loading…
Reference in a new issue