Skip to content

unify return values for destroy functions #1356

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lplewa
Copy link
Contributor

@lplewa lplewa commented Jun 5, 2025

fixes: #1217

Description

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly
  • CI workflows, not executed per PR (e.g. Nightly), execute properly
  • New tests added, especially if they will fail without my changes
  • Added/extended example(s) to cover this functionality
  • Extended the README/documentation
  • All newly added source files have a license
  • All newly added source files are referenced in CMake files
  • Logger (with debug/info/... messages) is used
  • All API changes are reflected in docs and def/map files, and are tested

@lplewa lplewa requested a review from a team as a code owner June 5, 2025 12:11
hPool->ops.finalize(hPool->pool_priv);
umf_result_t ret = UMF_RESULT_SUCCESS;
if (hPool->ops.finalize(hPool->pool_priv) != UMF_RESULT_SUCCESS) {
ret = UMF_RESULT_ERROR_UNKNOWN;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just pass the result from finalize()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to return unknown error when error is not recoverable and pool is corrupted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would return the error code received from ops.finalize() here - like you have done in umfMemoryProviderDestroy()

@@ -130,14 +130,15 @@ umf_result_t umfMemspaceNew(umf_memspace_handle_t *hMemspace) {
return UMF_RESULT_SUCCESS;
}

void umfMemspaceDestroy(umf_memspace_handle_t memspace) {
umf_result_t umfMemspaceDestroy(umf_memspace_handle_t memspace) {
assert(memspace);
for (size_t i = 0; i < memspace->size; i++) {
umfMemtargetDestroy(memspace->nodes[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check return val from umfMemtargetDestroy and retrun if if != success

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umfMemtargetDestroy returns void

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to this PR umfMemtargetDestroy should at least always return SUCCESS, right?

@@ -99,7 +99,7 @@ static const char *tbb_symbol[TBB_POOL_SYMBOLS_MAX] = {
"?pool_free@rml@@YA_NPEAVMemoryPool@1@PEAX@Z",
("?pool_create_v1@rml@@YA?AW4MemPoolError@1@_JPEBUMemPoolPolicy@1@"
"PEAPEAVMemoryPool@1@@Z"),
"?pool_destroy@rml@@YA_NPEAVMemoryPool@1@@Z",
"?/* pool_destroy */@rml@@YA_NPEAVMemoryPool@1@@Z",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

????

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xD

file_memory_provider_t *file_provider = provider;

uintptr_t key = 0;
uintptr_t rkey = 0;
void *rvalue = NULL;
umf_result_t ret = UMF_RESULT_SUCCESS;
;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;

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.

unify return values for Destroy functions
3 participants