Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: don't call nng_fini() by default #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pynng/nng.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@
# during a callback to _nng_pipe_cb
# * Cleanup background queue threads used by NNG

# NOTE: enabling this can lead to nng panic / crash on python runtime shutdown. Depending on when the atexit function
# is called and objects garbage are collected, it might be possible that nng_fini is already called, but we are is
# still calling the nng lib (e.g. nni_aio_free by AIOHelper.__del__).

nng_fini_at_exit = False

def _pynng_atexit():
lib.nng_fini()
if nng_fini_at_exit:
lib.nng_fini()


atexit.register(_pynng_atexit)
Expand Down