Skip to content
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

Make library initialization explicit and mandatory with nng_init. #1915

Open
gdamore opened this issue Nov 4, 2024 · 1 comment
Open

Make library initialization explicit and mandatory with nng_init. #1915

gdamore opened this issue Nov 4, 2024 · 1 comment

Comments

@gdamore
Copy link
Contributor

gdamore commented Nov 4, 2024

There is some fairly sketchy initialization logic around nng_init, and it's possibly racy with nng_fini, and since these are done implicitly (at least nni_init is) this can lead to racy situations.

If we make this explicit, and require applications to call it up front, we can reference count calls, and be safe even with multiple consumers via a shared library, etc.

This would also allow us to eliminate nni_init() checks at run time one zillion hot paths, which also helps with code coverage, and some functions could then become no-fail (would allow changing function signatures in some cases, but having functions that cannot ever fail is good for applications.)

@gdamore
Copy link
Contributor Author

gdamore commented Nov 4, 2024

Note that nng_init can take an initialization structure so we could get rid of the undocumented and dodgy initialization overrides.

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

No branches or pull requests

1 participant