Skip to content

Commit

Permalink
[sg fromlist] fix: don't call nng_fini() by default
Browse files Browse the repository at this point in the history
  • Loading branch information
broglep-work authored and mlasch committed Apr 11, 2024
1 parent a484c81 commit 6d2f9db
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 6d2f9db

Please sign in to comment.