MkBufferListC - various functions to create and destroy a MkBufferListS … More...
Macros | |
#define | MkBufferListCreateTLS_T(name, num) |
create a MkBufferListC instance as thread-local-torage … | |
#define | MkBufferListCreateSTATIC_T(name, num) |
create a MkBufferListC instance on static-storage … | |
#define | MkBufferListCreateLOCAL_T(name, num) |
create a MkBufferListC instance on local-memory and return an pointer as instance … | |
#define | MkBufferListCreateTLS_inout_T(name, num, inout) |
create a MkBufferListC instance as thread-local-torage OR reuse inout if possible… | |
Functions | |
MK_BFL | MkBufferListCreate_RT (MK_RT mkrt, MK_NUM const size) |
Constructs a MkBufferC instance with size storage… | |
MK_BFL | MkBufferListCreateTLS_RT (MK_RT mkrt, MK_STRN const tlsName, bool const resetB) |
same as BufferListCreate but require no cleanup … | |
void | MkBufferListCreateTLS_T (MK_MACRO_TYP name, MK_NUM const num) |
void | MkBufferListCreateSTATIC_T (MK_MACRO_TYP name, MK_NUM const num) |
void | MkBufferListCreateLOCAL_T (MK_MACRO_TYP name, MK_NUM const num) |
void | MkBufferListCreateTLS_inout_T (MK_MACRO_TYP name, MK_NUM const num, MK_BFL *inout) |
MK_BFL | MkBufferListCreateVC_RT (MK_RT mkrt, MK_NUM const argc, MK_STRN const *argv) |
Constructs a MkBufferListC instance with a argc/argv data from a list of strings … | |
MK_BFL | MkBufferListCreateVAL_RT (MK_RT mkrt, MK_STRN const arg0, va_list var_list) |
Constructs a MkBufferListC instance with a va_list argument … | |
MK_BFL | MkBufferListCreateVA_RT (MK_RT mkrt, MK_STRN const arg0,...) |
Constructs a MkBufferListC instance with a varargs argument that ends with MK_NULL … | |
MK_BFL | MkBufferListCreateLA_RT (MK_RT mkrt, MK_BAC const args) |
Constructs a MkBufferListC instance with an other MkBufferListC OR a list of arguments (only in NON C) | |
MK_BFL | MkBufferListDup_RT (MK_RT mkrt, MK_BFLN const bfl) |
Dup-Constructor - create a new MkBufferListC instance as copy from an existing MkBufferListC instance … | |
MK_BFL | MkBufferListMerge_RT (MK_RT mkrt, MK_BFL const bfl) |
Merge-Constructor - constructs a MkBufferListC instance as a merge from an existing MkBufferListC instance … | |
void | MkBufferListInit_RT (MK_RT mkrt, MK_BFL const bfl, MK_NUM const num) |
initialize an already allocated MkBufferListC | |
void | MkBufferListFree_RT (MK_RT mkrt, MK_BFL const bfl) |
free the internal data but keep the outher shell alive | |
void | MkBufferListDelete_RT (MK_RT mkrt, MK_BFL bfl) |
Destructor - delete a MkBufferListC instance … | |
MkBufferListC - MkBufferListC_TOR_C_API - overload | |
#define | MkBufferListMerge_NULL(...) |
#define | MkBufferListMerge(...) |
#define | MkBufferListDup_NULL(...) |
#define | MkBufferListDup(...) |
#define | MkBufferListCreate_NULL(...) |
#define | MkBufferListCreate(...) |
#define | MkBufferListCreate_0() |
#define | MkBufferListCreateLA_NULL(...) |
#define | MkBufferListCreateLA(...) |
#define | MkBufferListCreateVA_NULL(...) |
#define | MkBufferListCreateVA(...) |
#define | MkBufferListCreateVAL_NULL(...) |
#define | MkBufferListCreateVAL(...) |
#define | MkBufferListCreateVC_NULL(...) |
#define | MkBufferListCreateVC(...) |
#define | MkBufferListDelete(x) |
#define | MkBufferListCreateTLS_NULL(...) |
#define | MkBufferListCreateTLS(...) |
#define | MkBufferListCreateTLS_1(tlsName) |
#define | MkBufferListFree_NULL(...) |
#define | MkBufferListFree(...) |
#define | MkBufferListInit_NULL(...) |
#define | MkBufferListInit(...) |
MkBufferListC - various functions to create and destroy a MkBufferListS …
#define MkBufferListCreate | ( | ... | ) |
Definition at line 625 of file kernel_overload_mk.h.
#define MkBufferListCreate_0 | ( | ) |
Definition at line 626 of file kernel_overload_mk.h.
#define MkBufferListCreate_NULL | ( | ... | ) |
Definition at line 624 of file kernel_overload_mk.h.
#define MkBufferListCreateLA | ( | ... | ) |
Definition at line 628 of file kernel_overload_mk.h.
#define MkBufferListCreateLA_NULL | ( | ... | ) |
Definition at line 627 of file kernel_overload_mk.h.
#define MkBufferListCreateLOCAL_T | ( | name, | |
num ) |
create a MkBufferListC instance on local-memory and return an pointer as instance …
name | is the instance-pointer and nameR is the instance-reference. |
num | is the minimal-size of the initial buffer-list, size will be inflated if necessary. |
Definition at line 431 of file MkBufferListC_def_mk.h.
#define MkBufferListCreateSTATIC_T | ( | name, | |
num ) |
create a MkBufferListC instance on static-storage …
name | is the instance-pointer and nameR is the instance-reference. |
num | is the minimal-size of the initial buffer-list, size will be inflated if necessary. |
Definition at line 410 of file MkBufferListC_def_mk.h.
#define MkBufferListCreateTLS | ( | ... | ) |
Definition at line 641 of file kernel_overload_mk.h.
#define MkBufferListCreateTLS_1 | ( | tlsName | ) |
Definition at line 642 of file kernel_overload_mk.h.
#define MkBufferListCreateTLS_inout_T | ( | name, | |
num, | |||
inout ) |
create a MkBufferListC instance as thread-local-torage OR reuse inout if possible…
The inout is an external-storage or MK_NULL
- the external storage will be reused or if MK_NULL
the internal thread-local-storage is used.
name | is the instance-pointer and nameR is the instance-reference. |
num | is the minimal-size of the initial buffer-list, size will be inflated if necessary. |
inout | is the preferred-storage, if MK_NULL the thread-local-storage is used. |
Definition at line 456 of file MkBufferListC_def_mk.h.
#define MkBufferListCreateTLS_NULL | ( | ... | ) |
Definition at line 640 of file kernel_overload_mk.h.
#define MkBufferListCreateTLS_T | ( | name, | |
num ) |
create a MkBufferListC instance as thread-local-torage …
name | is the instance-pointer and nameR is the instance-reference. |
num | is the minimal-size of the initial buffer-list, size will be inflated if necessary. |
Definition at line 384 of file MkBufferListC_def_mk.h.
#define MkBufferListCreateVA | ( | ... | ) |
Definition at line 630 of file kernel_overload_mk.h.
#define MkBufferListCreateVA_NULL | ( | ... | ) |
Definition at line 629 of file kernel_overload_mk.h.
#define MkBufferListCreateVAL | ( | ... | ) |
Definition at line 632 of file kernel_overload_mk.h.
#define MkBufferListCreateVAL_NULL | ( | ... | ) |
Definition at line 631 of file kernel_overload_mk.h.
#define MkBufferListCreateVC | ( | ... | ) |
Definition at line 634 of file kernel_overload_mk.h.
#define MkBufferListCreateVC_NULL | ( | ... | ) |
Definition at line 633 of file kernel_overload_mk.h.
#define MkBufferListDelete | ( | x | ) |
Definition at line 637 of file kernel_overload_mk.h.
#define MkBufferListDup | ( | ... | ) |
Definition at line 621 of file kernel_overload_mk.h.
#define MkBufferListDup_NULL | ( | ... | ) |
Definition at line 620 of file kernel_overload_mk.h.
#define MkBufferListFree | ( | ... | ) |
Definition at line 646 of file kernel_overload_mk.h.
#define MkBufferListFree_NULL | ( | ... | ) |
Definition at line 645 of file kernel_overload_mk.h.
#define MkBufferListInit | ( | ... | ) |
Definition at line 648 of file kernel_overload_mk.h.
#define MkBufferListInit_NULL | ( | ... | ) |
Definition at line 647 of file kernel_overload_mk.h.
#define MkBufferListMerge | ( | ... | ) |
Definition at line 617 of file kernel_overload_mk.h.
#define MkBufferListMerge_NULL | ( | ... | ) |
Definition at line 616 of file kernel_overload_mk.h.
Constructs a MkBufferC instance with size storage…
The new instance belongs to the caller and may have to be released if necessary. A manual release using BufferListDelete is always possible, but the instance can no longer be used afterwards.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | size | The initial size of the instance-local-storage. The MkBufferListC has dynamic-memory-management, the size value is just a hint to provide enought memory for future tasks. The real size created is the maximum of type-ILS-size and size . (default: 0 = use the type-ILS-size) |
Constructs a MkBufferListC instance with an other MkBufferListC OR a list of arguments (only in NON C)
The new instance belongs to the caller and may have to be released if necessary. A manual release using BufferListDelete is always possible, but the instance can no longer be used afterwards.
void MkBufferListCreateLOCAL_T | ( | MK_MACRO_TYP | name, |
MK_NUM const | num ) |
void MkBufferListCreateSTATIC_T | ( | MK_MACRO_TYP | name, |
MK_NUM const | num ) |
void MkBufferListCreateTLS_inout_T | ( | MK_MACRO_TYP | name, |
MK_NUM const | num, | ||
MK_BFL * | inout ) |
same as BufferListCreate but require no cleanup …
Example from perfserver.c
→ performance test with TLS storage
Example from LibSq3LiteRpcClient.tcl
→ callback dealing the temporary TLS data
# Intro : Example from tcl-rpc-client of using a CreateTLS-like function (here for MkBufferListC) # to improve code speed and readability. # # Problem : This function is used to invoke a callback (myCb). The arguments come from the argument # list args *and* from a service call (ReadBFL). # The problem is that ReadBFL is called *twice* and the *second* call overwrites the value # of the *first* call because CreateTLS always returns *the same* MkBufferListC, just # replaced with a new set of values. # # Solution : The MkBufferListC instance returned by ReadBFL is copied into another MkBufferListC # instance returned by CreateTLS. # The "CreateTLS" instance is only created *once* and reused, *but* now we can create as # many MkBufferListC instances as we want, because "CreateTLS" distinguishes the returned # instances by the string identifier. # WITHOUT "CreateTLS" a copy would have to be created (Dup) which would then be destroyed # *after* the callback is called (Delete) proc Sq3LiteRpcClientExecV2CB {rpc myCb args} { set valL [MkBufferListC CreateTLS "Sq3LiteRpcClientExecV2CB→valL"] set colL [MkBufferListC CreateTLS "Sq3LiteRpcClientExecV2CB→colL"] $valL Copy [$rpc ReadBFL] $colL Copy [$rpc ReadBFL] $myCb {*}$args $valL $colL }
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | tlsName | An per-thread unique name (string) to identify the reuse-able instance-storage. if tlsName is MK_NULL or "" than a MK_NULL is returned |
[in] | resetB | should the new object be reset? |
void MkBufferListCreateTLS_T | ( | MK_MACRO_TYP | name, |
MK_NUM const | num ) |
Constructs a MkBufferListC instance with a varargs argument that ends with MK_NULL
…
The new instance belongs to the caller and may have to be released if necessary. A manual release using BufferListDelete is always possible, but the instance can no longer be used afterwards.
Constructs a MkBufferListC instance with a va_list argument …
The new instance belongs to the caller and may have to be released if necessary. A manual release using BufferListDelete is always possible, but the instance can no longer be used afterwards.
Constructs a MkBufferListC instance with a argc/argv data from a list of strings …
The new instance belongs to the caller and may have to be released if necessary. A manual release using BufferListDelete is always possible, but the instance can no longer be used afterwards.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
argc | the argc from the initial main function | |
argv | the arguments from the initial main function |
argc = 0
Destructor - delete a MkBufferListC instance …
There are two different ways to delete an instance:
ObjectDispose | to free the internal data but keep the outher shell alive - this is called a SOFT-DELETE |
ObjectDelete | to delete the outher shell including the internal data - this is called a HARD-DELETE |
Dup-Constructor - create a new MkBufferListC instance as copy from an existing MkBufferListC instance …
The new instance belongs to the caller and may have to be released if necessary. A manual release using BufferListDelete is always possible, but the instance can no longer be used afterwards.
free the internal data but keep the outher shell alive
initialize an already allocated MkBufferListC
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | bfl | the MkBufferListS instance to work on |
num | initial array size |
Example: create a static buffer-list with default size of MkBufferListS_bls_size
Merge-Constructor - constructs a MkBufferListC instance as a merge from an existing MkBufferListC instance …
The Merge-Constructor create a new object-shell, and take-over all the internal data from the source-object. After the Merge-Constructor the source-object is empty as if a BufferListReset was called.
One usage of the Merge-Constructor is to get a lightweight-copy of a Thread-Local-Storage object for external usage.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | bfl | the MkBufferListS instance to work on |
MK_NULL
on error or if no Merge-Constructor is available