Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros | Functions
afw_pool_singlethreaded.c File Reference

Adaptive Frameworksinglethreaded pool implementation. More...

#include "afw_internal.h"
#include "afw_pool_impl_declares.h"

Go to the source code of this file.

Macros

#define AFW_IMPLEMENTATION_ID   "afw_pool_singlethreaded"
 
#define IMPL_DEBUG_LEVEL_detail   flag_index_debug_pool_detail
 
#define IMPL_DEBUG_LEVEL_minimal   flag_index_debug_pool
 
#define IMPL_PRINT_DEBUG_INFO_Z(level, info_z)
 
#define IMPL_PRINT_DEBUG_INFO_FZ(level, format_z, ...)
 

Functions

 afw_pool_create (const afw_pool_t *parent, afw_xctx_t *xctx)
 Create a new pool. More...
 
 afw_pool_create_debug (const afw_pool_t *parent, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 Debug version of create a new pool. More...
 
 afw_pool_internal_create_thread (afw_size_t size, afw_xctx_t *xctx)
 
 afw_pool_internal_create_thread_debug (afw_size_t size, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void impl_afw_pool_release (const afw_pool_t *instance, afw_xctx_t *xctx)
 
void impl_afw_pool_add_reference (const afw_pool_t *instance, afw_xctx_t *xctx)
 
void impl_afw_pool_destroy (const afw_pool_t *instance, afw_xctx_t *xctx)
 
apr_pool_t * impl_afw_pool_get_apr_pool (const afw_pool_t *instance)
 
void * impl_afw_pool_calloc (const afw_pool_t *instance, afw_size_t size, afw_xctx_t *xctx)
 
void * impl_afw_pool_malloc (const afw_pool_t *instance, afw_size_t size, afw_xctx_t *xctx)
 
void impl_afw_pool_free (const afw_pool_t *instance, void *address, afw_size_t size, afw_xctx_t *xctx)
 
void impl_afw_pool_register_cleanup_before (const afw_pool_t *instance, void *data, void *data2, afw_pool_cleanup_function_p_t cleanup, afw_xctx_t *xctx)
 
void impl_afw_pool_deregister_cleanup (const afw_pool_t *instance, void *data, void *data2, afw_pool_cleanup_function_p_t cleanup, afw_xctx_t *xctx)
 
void impl_afw_pool_release_debug (const afw_pool_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void impl_afw_pool_add_reference_debug (const afw_pool_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void impl_afw_pool_destroy_debug (const afw_pool_t *instance, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void * impl_afw_pool_calloc_debug (const afw_pool_t *instance, afw_size_t size, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void * impl_afw_pool_malloc_debug (const afw_pool_t *instance, afw_size_t size, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void impl_afw_pool_free_debug (const afw_pool_t *instance, void *address, afw_size_t size, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void impl_afw_pool_register_cleanup_before_debug (const afw_pool_t *instance, void *data, void *data2, afw_pool_cleanup_function_p_t cleanup, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 
void impl_afw_pool_deregister_cleanup_debug (const afw_pool_t *instance, void *data, void *data2, afw_pool_cleanup_function_p_t cleanup, afw_xctx_t *xctx, const afw_utf8_z_t *source_z)
 

Detailed Description

Adaptive Frameworksinglethreaded pool implementation.

Definition in file afw_pool_singlethreaded.c.

Macro Definition Documentation

◆ IMPL_DEBUG_LEVEL_detail

#define IMPL_DEBUG_LEVEL_detail   flag_index_debug_pool_detail
Todo:
FIXME: If pool is multithread, use a lock when changing memory.

Definition at line 27 of file afw_pool_singlethreaded.c.

◆ IMPL_PRINT_DEBUG_INFO_FZ

#define IMPL_PRINT_DEBUG_INFO_FZ (   level,
  format_z,
  ... 
)
Value:
do { \
const afw_utf8_t *trace; \
if (afw_flag_is_active(xctx->env->IMPL_DEBUG_LEVEL_##level, xctx)) \
{ \
trace = afw_os_backtrace(0, -1, xctx); \
afw_debug_write_fz(NULL, source_z, xctx, \
"pool %" AFW_INTEGER_FMT " " \
format_z \
": before %" AFW_SIZE_T_FMT \
" refs %" AFW_INTEGER_FMT \
" parent %" AFW_INTEGER_FMT \
" single" \
"%s" \
"%" AFW_UTF8_FMT, \
self->pool_number, \
__VA_ARGS__, \
(self->bytes_allocated), \
(self->reference_count), \
(afw_integer_t)((self->parent) ? self->parent->pool_number : 0), \
(char *)((trace) ? "\n" : ""), \
(int)((trace) ? (int)trace->len : 0), \
(const char *)((trace) ? (const char *)trace->s : "") \
); \
} \
} while (0) \
#define AFW_INTEGER_FMT
Format string specifier used for afw_integer_t.
Definition: afw_common.h:326
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
Definition: afw_common.h:588
#define AFW_SIZE_T_FMT
Format string specifier used for afw_size_t.
Definition: afw_common.h:341
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
#define afw_flag_is_active(flag_index, xctx)
Determine if flag for flag index is set in xctx.
Definition: afw_flag.h:84
const afw_utf8_t * afw_os_backtrace(afw_error_code_t code, int max_backtrace, afw_xctx_t *xctx)
Provide a backtrace if possible.
Definition: nix/afw_os.c:729
NFC normalized UTF-8 string.
Definition: afw_common.h:545

Definition at line 57 of file afw_pool_singlethreaded.c.

◆ IMPL_PRINT_DEBUG_INFO_Z

#define IMPL_PRINT_DEBUG_INFO_Z (   level,
  info_z 
)
Value:
do { \
const afw_utf8_t *trace; \
if (afw_flag_is_active(xctx->env->IMPL_DEBUG_LEVEL_##level, xctx)) \
{ \
trace = afw_os_backtrace(0, -1, xctx); \
afw_debug_write_fz(NULL, source_z, xctx, \
"pool %" AFW_INTEGER_FMT " " \
info_z \
": before %" AFW_SIZE_T_FMT \
" refs %" AFW_INTEGER_FMT \
" parent %" AFW_INTEGER_FMT \
" single" \
"%s" \
"%" AFW_UTF8_FMT, \
self->pool_number, \
(self->bytes_allocated), \
(self->reference_count), \
(afw_integer_t)((self->parent) ? self->parent->pool_number : 0), \
(char *)((trace) ? "\n" : ""), \
(int)((trace) ? (int)trace->len : 0), \
(const char *)((trace) ? (const char *)trace->s : "") \
); \
} \
} while (0) \

Definition at line 30 of file afw_pool_singlethreaded.c.