libpod: shutdown Stop waits for handlers completion

wait for handlers currently being processed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2024-07-14 19:44:43 +02:00
parent 6832a35f65
commit fbc4768a00

View File

@ -91,6 +91,11 @@ func Stop() error {
return nil
}
// if the signal handler is running, wait that it terminates
handlerLock.Lock()
defer handlerLock.Unlock()
// it doesn't need to be in the critical section, but staticcheck complains if
// the critical section is empty.
cancelChan <- true
return nil