Skip to content

Add init/teardown functions: umfInit() and umfTearDown() #530

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

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented Jun 5, 2024

Description

Add init/teardown functions: umfInit() and umfTearDown():

  • umfInit() increments the usage reference counter and initializes the global state of libumf if the usage reference counter was equal 0. Returns 0 on success or -1 on failure.

  • umfTearDown() decrements the usage reference counter and destroys the global state of libumf if the usage reference counter is equal 0.

Fixes: #514

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly

@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from 17a9f28 to a65ebfc Compare June 5, 2024 12:05
@ldorau ldorau requested review from bratpiorka and PatKamin June 5, 2024 12:08
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch 7 times, most recently from e81f9d8 to b92394a Compare June 5, 2024 20:50
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from b92394a to 699863b Compare June 6, 2024 07:44
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch 2 times, most recently from bf6dcd5 to 8afff82 Compare June 6, 2024 09:08
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from 8afff82 to c9bbece Compare June 6, 2024 10:39
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from c9bbece to 3fa7cb3 Compare June 6, 2024 11:36
@ldorau ldorau marked this pull request as draft June 6, 2024 13:10
@ldorau
Copy link
Contributor Author

ldorau commented Jun 6, 2024

Converted to a draft, because CI builds sometimes fail.

@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch 2 times, most recently from ade1161 to 905dced Compare June 7, 2024 07:35
@ldorau ldorau marked this pull request as ready for review June 7, 2024 07:36
@lukaszstolarczuk
Copy link
Contributor

lukaszstolarczuk commented Jun 7, 2024

you can rebase with the temp CI hotfix (already on main)

@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from 905dced to 3bab226 Compare June 10, 2024 08:20
@ldorau
Copy link
Contributor Author

ldorau commented Jun 10, 2024

you can rebase with the temp CI hotfix (already on main)

@lukaszstolarczuk @bratpiorka Rebased

@ldorau ldorau requested a review from lukaszstolarczuk June 10, 2024 08:22
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from 3bab226 to ee23203 Compare June 10, 2024 10:10
ldorau added 3 commits June 10, 2024 12:28
Reset all UTIL_ONCE_FLAG variables to UTIL_ONCE_FLAG_INIT
at the end of destroying.

Signed-off-by: Lukasz Dorau <[email protected]>
- umfInit() increments the usage reference counter
  and initializes the global state of libumf
  if the usage reference counter was equal 0.
  Returns 0 on success or -1 on failure.
  It must be called just after dlopen()
  and it is not required in other scenarios.

- umfTearDown() decrements the usage reference counter
  and destroys the global state of libumf
  if the usage reference counter is equal 0.
  It must be called just before dlclose()
  and it is not required in other scenarios.

Fixes: oneapi-src#514

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Add_init_teardown_functions_umfInit_and_umfTearDown branch from ee23203 to a562f8e Compare June 10, 2024 10:29
@ldorau
Copy link
Contributor Author

ldorau commented Jun 10, 2024

@bratpiorka @lukaszstolarczuk all builds pass now

@bratpiorka bratpiorka merged commit 40d5329 into oneapi-src:main Jun 10, 2024
66 checks passed
@ldorau ldorau deleted the Add_init_teardown_functions_umfInit_and_umfTearDown branch June 10, 2024 12:45
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.

Introduce init/teardown functions instead of relying on library ctor/dtor
5 participants