-
Notifications
You must be signed in to change notification settings - Fork 42
Split initialize function and add post-initialize phase #1467
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,9 @@ typedef struct umf_memory_pool_ops_t { | |
|
|
||
| /// | ||
| /// @brief Initializes memory pool. | ||
| /// /details | ||
| /// * The memory pool implementation *must* allocate the memory pool structure | ||
| /// and return it by the \p pool parameter. | ||
| /// @param provider memory provider that will be used for coarse-grain allocations. | ||
| /// @param params pool-specific params, or NULL for defaults | ||
| /// @param pool [out] returns pointer to the pool | ||
|
|
@@ -191,6 +194,25 @@ typedef struct umf_memory_pool_ops_t { | |
| /// failure. | ||
| /// | ||
| umf_result_t (*ext_trim_memory)(void *pool, size_t minBytesToKeep); | ||
|
|
||
| /// | ||
| /// @brief Post-initializes and set up memory pool. | ||
lukaszstolarczuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// Post-construction hook for memory pools, enabling advanced or deferred setup that cannot | ||
| /// be done in the initial allocation phase (e.g. setting defaults from CTL). | ||
| /// | ||
| /// \details | ||
| /// * This function *must* be implemented if the pool/provider supports CTL that overrides defaults. | ||
| /// * This function *must* free any resources allocated in the function. | ||
| /// * This function *must* be called after the memory pool has been allocated in initialize function | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Must be called by whom? If UMF calls it, then the comment is missleading. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's about the function order. Generally, this function is the same case as |
||
| /// and is used to perform any additional setup required by the memory pool. | ||
| /// * This function *may* be used to set up any additional resources required by the memory pool. | ||
| /// * This function *may* be used to set up default values for the memory pool parameters set up by CTL. | ||
| /// | ||
| /// @param pool pointer to the pool | ||
| /// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure | ||
| /// | ||
| umf_result_t (*ext_post_initialize)(void *pool); | ||
|
|
||
| } umf_memory_pool_ops_t; | ||
|
|
||
| #ifdef __cplusplus | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.