-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: main
Are you sure you want to change the base?
Conversation
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; |
There was a problem hiding this comment.
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()?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
umfMemtargetDestroy returns void
There was a problem hiding this comment.
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?
src/pool/pool_scalable.c
Outdated
@@ -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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
????
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xD
src/provider/provider_file_memory.c
Outdated
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; | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;
fixes: #1217
Description
Checklist