Soletta™ Framework
|
Data Structures | |
struct | sol_reentrant |
Structure containing the flags for safely freeing a larger structure. More... | |
Macros | |
#define | SOL_REENTRANT_CALL(handle) |
Wraps a function call to an external callback. More... | |
#define | SOL_REENTRANT_FREE(reentrant) if (({ (reentrant).delete_me = true; !(reentrant).in_use; })) |
Conditionally free a reentrant structure. More... | |
Typedefs | |
typedef struct sol_reentrant | sol_reentrant |
Structure containing the flags for safely freeing a larger structure. More... | |
#define SOL_REENTRANT_CALL | ( | handle | ) |
Wraps a function call to an external callback.
handle | The reentrant tracking the structure affected by the function call |
Wraps the statement or statement block following it by marking the handle passed in as the parameter as being in use. Thus, if you call an external callback from within the block which attempts to free the structure, the structure will be protected from deletion by the flags set in the preamble. For example:
will ensure that the context will not be freed as part of the call to context->cb()
and will be available after context->cb()
returns as long as all calls to free the context are made via SOL_REENTRANT_FREE().
Referenced by _inform_user().
#define SOL_REENTRANT_FREE | ( | reentrant | ) | if (({ (reentrant).delete_me = true; !(reentrant).in_use; })) |
Conditionally free a reentrant structure.
reentrant | The reentrant to free |
Provides a condition statement for calling the function that frees the structure associated with the reentrant passed in as the parameter. As a side effect it also marks the structure as needing deletion.
Referenced by _inform_user(), and my_stream_api_close().
typedef struct sol_reentrant sol_reentrant |
Structure containing the flags for safely freeing a larger structure.
This structure is meant to be used inside larger structures which are affected by calls to external callbacks that in turn end up calling library APIs. The possibility of a double free is particularly likely in such cases.