centralize registration of exit handlers #230
centralize registration of exit handlers #230openshift-merge-bot[bot] merged 2 commits intocrc-org:mainfrom
Conversation
|
Skipping CI for Draft Pull Request. |
| // This method is useful when a caller wishes to execute a func before a shutdown. | ||
| func RegisterExitHandler(handler func()) { | ||
| exitHandlers = append(exitHandlers, handler) | ||
| } |
There was a problem hiding this comment.
The use of a global variable means RegisterExitHandler should not be called from multiple go routines simultaneously. The next commit will call it from a go routine which is not the main one, it's safer to add a mutex to protect accesses to exitHandlers.
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfergeau The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
this PR centralizes the registration of exit handlers so that we can register an exit handler from anywhere and it will be invoked before terminating vfkit.
The PR also registers an exit handler to remove the ignition socket.
It resolves #229