Skip to content

Allow user code to register for a callback on shutdown. #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2018

Conversation

benoithudson
Copy link

Call PythonEngine.AddShutdownHandler

Call RemoveShutdownHandler if you don't want the callback anymore.

You can register several, they get called in reverse order.

This is needed to cleanly close sockets, UI, etc.
Copy link
Collaborator

@lassond lassond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this will be very useful!
I hacked it on my side with a pure delegate instead of a list (which turns into a multicast delegate as you add delegates. I like your approach though, it is more sound in the context of init/shutdown

@benoithudson benoithudson merged commit 88ee2e0 into dev Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants