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

Reference counting of InitAPI #2411

Open
1 of 2 tasks
jmklix opened this issue Mar 29, 2023 · 5 comments
Open
1 of 2 tasks

Reference counting of InitAPI #2411

jmklix opened this issue Mar 29, 2023 · 5 comments
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue

Comments

@jmklix
Copy link
Member

jmklix commented Mar 29, 2023

Describe the feature

Provide a mechanism to prevent the sdk from breaking when InitAPI gets called when it has already been initialized.

Related issues/discussions:

Use Case

If code is being used in a library then there is currently no way for the library to know if InitAPI has already been called.

Proposed Solution

This will not/should not be RAII.

Using locks and reference counting this would allow multiple calls of InitAPI. Changes need to be make on this sdk and with the CRT

Other Information

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue, please leave a comment

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@jmklix jmklix added feature-request A feature should be added or improved. p2 This is a standard priority issue labels Mar 29, 2023
@WolfgangVogl
Copy link

Just to clearify this for me: Calling InitAPI multiple times on a machine is okay as long as you don't do it inside the same application? Or has such a reference count to be system wide?

@jmklix
Copy link
Member Author

jmklix commented Mar 31, 2023

Just to clearify this for me: Calling InitAPI multiple times on a machine is okay as long as you don't do it inside the same application? Or has such a reference count to be system wide?

Yes, that should be fine as long as the programs aren't sharing memory

@jeking3
Copy link
Contributor

jeking3 commented Apr 24, 2023

You can also handle the error result when it is already initialized, and ignore it.

@jmklix jmklix added the needs-review This issue or pull request needs review from a core team member. label Jun 30, 2023
@jmklix
Copy link
Member Author

jmklix commented Jun 30, 2023

03036e4

@johnkerl
Copy link

johnkerl commented Jun 7, 2024

Does anyone know why #2699 triggers only on MacOS? We see this only on MacOS, not Linux, and I'd like to understand what's Mac-specific here ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

4 participants