MkRuntimeC - The MkRuntimeRLS, a thread-local storage for application-global data … More...
Classes | |
struct | libmkkernel::MkRuntimeCallbackS |
keep callback related data … More... | |
Macros | |
#define | MK_RT_ATTR_HDL_CHECK(x) |
#define | MK_RT_ATTR_CHECK_RUNTIME_NULL MkRtSetup_NULL_RT |
#define | MK_RT_ATTR_CHECK_RUNTIME_XN(x) |
#define | MK_RT_ATTR_CHECK_RUNTIME_ON(x) |
#define | MK_RT_ATTR_CHECK_RUNTIME_O(x) |
#define | MK_RT_ATTR_NONNULL_1_CHECK(x) |
#define | MK_RT_ATTR_NONNULL_2_CHECK(x) |
Typedefs | |
typedef void(* | libmkkernel::MkRuntimeInitF) (struct MkRuntimeS *mkRt) |
additional runtime initialization function … | |
Functions | |
MK_EXTERN MK_RT | libmkkernel::MkRuntimeInit (MK_RT const mkrt) |
initialize MkRuntimeRLS … | |
MK_RT | libmkkernel::MkRuntimeGet (void) |
return a initialized MkRuntimeRLS … | |
Variables | |
MK_EXTERN_DATA MkThreadLocal struct MkRuntimeS | libmkkernel::MkRuntimeRLS |
RLS … | |
MkRuntimeCallback | |
Register callback used to setup library-local runtime attributes … Sometimes the features provided by MkRuntimeRLS are not fullfilling the requirements of the implementation. Sometimes the functions provided by the MkRuntimeRLS do not meet the implementation requirements. Two methods are offered to retrofit the missing capability:
| |
MK_EXTERN void | libmkkernel::MkRuntimeCallbackAdd (struct MkRuntimeCallbackS *cbdata, MK_RT mkrt, MkRuntimeInitF rt_callback, MK_STRN ident) |
add a callback to the runtime … | |
MK_EXTERN void | libmkkernel::MkRuntimeCallbackDel (struct MkRuntimeCallbackS *cbdata) |
delete a callback from the runtime … | |
META_HAS_THREAD | |
#define | MkThreadLocal __thread |
#define | MK_RT_IS_ARG 1 |
#define | MK_RT_ARGS_ONLY MK_RT mkrt |
#define | MK_RT_ARGS MK_RT_ARGS_ONLY, |
#define | MK_RT_CALL_ONLY mkrt |
#define | MK_RT_CALL MK_RT_CALL_ONLY, |
#define | MK_RT_CALL_O(o) |
#define | MK_RT_CALL_X(x) |
#define | MK_RT_CALL_NULL_ONLY MkRT |
#define | MK_RT_CALL_NULL MK_RT_CALL_NULL_ONLY, |
#define | MK_RT_NULL NULL, |
#define | MK_RT_PTR mkrt |
#define | MK_RT_REF (*mkrt) |
#define | MK_RT_REF_NULL (MkRuntimeRLS) |
#define | MK_RT_UNUSED MK_UNUSED |
#define | MK_RT_CALL_RT(ptr) |
#define | MK_RT_PARSER_ONLY MK_RT_ARGS_ONLY __parser__(internal,default=N#RUNTIME) |
#define | MK_RT_PARSER MK_RT_PARSER_ONLY, |
#define | MK_RT_ATTR_FORMAT_1 __attribute__((format (printf, 2, 3))) |
#define | MK_RT_ATTR_FORMAT_2 __attribute__((format (printf, 3, 4))) |
#define | MK_RT_ATTR_FORMAT_4 __attribute__((format (printf, 5, 6))) |
#define | MK_RT_ATTR_RUNTIME |
#define | MK_RT_ATTR_NONNULL_1 |
#define | MK_RT_ATTR_NONNULL_2 |
#define | MK_RT_ATTR_HDL |
#define | MK_RT_ATTR_HDL |
MkRtSetup | |
#define | MkRT (&MkRuntimeRLS) |
#define | MkRT_R (MkRuntimeRLS) |
#define | MkRT_O(o) |
#define | MkRT_X(x) |
#define | MkRT_ONN(o) |
#define | MkRT_ON(o) |
#define | MkRT_XN(x) |
#define | MkRtSetup_O(o) |
#define | MkRtSetup_X(x) |
#define | MkRtSetup_XN(x) |
#define | MkRtSetup_ON(o) |
#define | MkRtSetup_NULL MK_RT_UNUSED MK_RT const mkrt = MkRuntimeGet(); |
#define | MkRtSetup_RT(r) |
#define | MkRtSetupFromRtExt(rtx) |
#define | MkRtSetup_O_RT(o) |
#define | MkRtSetup_X_RT(x) |
#define | MkRtSetup_XN_RT(x) |
#define | MkRtSetup_ON_RT(o) |
#define | MkRtSetup_NULL_RT if (mkrt == NULL) mkrt = MkRT |
MkRuntimeC - The MkRuntimeRLS, a thread-local storage for application-global data …
The goal of the runtime-interface is to provide the best performance for thread and non-thread.
configure --enable-threads ...
. configure --disable-threads ...
. MK_RT_*
, MkRt*
or MkRT*
macros. MkThreadLocal struct MkRuntimeS MkRuntimeRLS = {0};
. (&MkRuntimeRLS)
__thread
with thread-support and otherwise to empty
. MkRtSetup_xxx
call after the thread-creation.Always use the
MK_RT_xxx
andMkRtSetup_xxx
macros to get best performane to access the MkRuntimeRLS. Summary: Internal access to the MkRuntimeRLS
threaded storage resolve access MkRtSetup_xxx
speed yes thread-local-storage run-time cache via mkrt fast enough but slower than non-thread no application-global-storage compile-time direct via MkRT fast
The local-cache is only required for a threaded-environment and is defined internal as mkrt variable initialized with a pointer to the MkRuntimeRLS.
do NOT use the mkrt direct because your code will NOT compile in a non-thread environment.
In a runtime-aware function the local-cache is always as first argument in the function.
In a non-runtime-aware method the local-cache is created using the instance-argument:
In a non-runtime-aware static-function the local-cache is created using TLS direct:
In a non-runtime-aware static-function with instance-argument the local-cache is created using instArg:
Summary: In a non-runtime-aware function use the instance to setup the cache-access otherwise MkRtSetup_NULL:
source | local-cache is created with | example | speed |
---|---|---|---|
instance | MkRtSetup_O , MkRtSetup_X | MkRtSetup_X(instance) | fast |
runtime | MkRtSetup_NULL | MkRtSetup_NULL | slow in non-static |
access as | macro | threaded | nothreaded | example | speed |
---|---|---|---|---|---|
reference | MK_RT_REF | (*mkrt) | MkRuntimeRLS | MK_RT_REF.debug | fast if static |
pointer | MK_RT_PTR | mkrt | (&MkRuntimeRLS) | MK_RT_PTR->debug | slow |
args | function definition | function parser extension | function call |
---|---|---|---|
multiple args | MK_RT_ARGS | MK_RT_PARSER | MK_RT_CALL |
no args | MK_RT_ARGS_ONLY | MK_RT_PARSER_ONLY | MK_RT_CALL_ONLY |
MK_RT_ARGS
... and MK_RT_CALL
... and the first argument is no comma.libmkkernel
is mk
,Mk,MK libmqmsgque
is mq
,Mq,MQ liblcconfig
is lc
,Lc,LC libsq3lite
is sq3
,Sq3,SQ3 #define MK_RT_ARGS MK_RT_ARGS_ONLY, |
Definition at line 775 of file LibMkKernel_mk.h.
#define MK_RT_ARGS_ONLY MK_RT mkrt |
Definition at line 774 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_CHECK_RUNTIME_NULL MkRtSetup_NULL_RT |
Definition at line 852 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_CHECK_RUNTIME_O | ( | x | ) |
Definition at line 855 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_CHECK_RUNTIME_ON | ( | x | ) |
Definition at line 854 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_CHECK_RUNTIME_XN | ( | x | ) |
Definition at line 853 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_FORMAT_1 __attribute__((format (printf, 2, 3))) |
Definition at line 790 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_FORMAT_2 __attribute__((format (printf, 3, 4))) |
Definition at line 791 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_FORMAT_4 __attribute__((format (printf, 5, 6))) |
Definition at line 792 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_HDL |
Definition at line 803 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_HDL |
Definition at line 803 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_HDL_CHECK | ( | x | ) |
Definition at line 849 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_NONNULL_1 |
Definition at line 801 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_NONNULL_1_CHECK | ( | x | ) |
Definition at line 856 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_NONNULL_2 |
Definition at line 802 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_NONNULL_2_CHECK | ( | x | ) |
Definition at line 857 of file LibMkKernel_mk.h.
#define MK_RT_ATTR_RUNTIME |
Definition at line 795 of file LibMkKernel_mk.h.
#define MK_RT_CALL MK_RT_CALL_ONLY, |
Definition at line 777 of file LibMkKernel_mk.h.
#define MK_RT_CALL_NULL MK_RT_CALL_NULL_ONLY, |
Definition at line 781 of file LibMkKernel_mk.h.
#define MK_RT_CALL_NULL_ONLY MkRT |
Definition at line 780 of file LibMkKernel_mk.h.
#define MK_RT_CALL_O | ( | o | ) |
Definition at line 778 of file LibMkKernel_mk.h.
#define MK_RT_CALL_ONLY mkrt |
Definition at line 776 of file LibMkKernel_mk.h.
#define MK_RT_CALL_RT | ( | ptr | ) |
Definition at line 787 of file LibMkKernel_mk.h.
#define MK_RT_CALL_X | ( | x | ) |
Definition at line 779 of file LibMkKernel_mk.h.
#define MK_RT_IS_ARG 1 |
Definition at line 773 of file LibMkKernel_mk.h.
#define MK_RT_NULL NULL, |
Definition at line 782 of file LibMkKernel_mk.h.
#define MK_RT_PARSER MK_RT_PARSER_ONLY, |
Definition at line 789 of file LibMkKernel_mk.h.
#define MK_RT_PARSER_ONLY MK_RT_ARGS_ONLY __parser__(internal,default=N#RUNTIME) |
Definition at line 788 of file LibMkKernel_mk.h.
#define MK_RT_PTR mkrt |
Definition at line 783 of file LibMkKernel_mk.h.
#define MK_RT_REF (*mkrt) |
Definition at line 784 of file LibMkKernel_mk.h.
#define MK_RT_REF_NULL (MkRuntimeRLS) |
Definition at line 785 of file LibMkKernel_mk.h.
#define MK_RT_UNUSED MK_UNUSED |
Definition at line 786 of file LibMkKernel_mk.h.
#define MkRT (&MkRuntimeRLS) |
Definition at line 11575 of file LibMkKernel_mk.h.
#define MkRT_O | ( | o | ) |
Definition at line 11579 of file LibMkKernel_mk.h.
#define MkRT_ON | ( | o | ) |
Definition at line 11582 of file LibMkKernel_mk.h.
#define MkRT_ONN | ( | o | ) |
Definition at line 11581 of file LibMkKernel_mk.h.
#define MkRT_R (MkRuntimeRLS) |
Definition at line 11576 of file LibMkKernel_mk.h.
#define MkRT_X | ( | x | ) |
Definition at line 11580 of file LibMkKernel_mk.h.
#define MkRT_XN | ( | x | ) |
Definition at line 11583 of file LibMkKernel_mk.h.
#define MkRtSetup_NULL MK_RT_UNUSED MK_RT const mkrt = MkRuntimeGet(); |
Definition at line 11597 of file LibMkKernel_mk.h.
#define MkRtSetup_NULL_RT if (mkrt == NULL) mkrt = MkRT |
Definition at line 11606 of file LibMkKernel_mk.h.
#define MkRtSetup_O | ( | o | ) |
Definition at line 11593 of file LibMkKernel_mk.h.
#define MkRtSetup_O_RT | ( | o | ) |
Definition at line 11602 of file LibMkKernel_mk.h.
#define MkRtSetup_ON | ( | o | ) |
Definition at line 11596 of file LibMkKernel_mk.h.
#define MkRtSetup_ON_RT | ( | o | ) |
Definition at line 11605 of file LibMkKernel_mk.h.
#define MkRtSetup_RT | ( | r | ) |
Definition at line 11598 of file LibMkKernel_mk.h.
#define MkRtSetup_X | ( | x | ) |
Definition at line 11594 of file LibMkKernel_mk.h.
#define MkRtSetup_X_RT | ( | x | ) |
Definition at line 11603 of file LibMkKernel_mk.h.
#define MkRtSetup_XN | ( | x | ) |
Definition at line 11595 of file LibMkKernel_mk.h.
#define MkRtSetup_XN_RT | ( | x | ) |
Definition at line 11604 of file LibMkKernel_mk.h.
#define MkRtSetupFromRtExt | ( | rtx | ) |
Definition at line 11599 of file LibMkKernel_mk.h.
#define MkThreadLocal __thread |
Definition at line 772 of file LibMkKernel_mk.h.
typedef void( * libmkkernel::MkRuntimeInitF) (struct MkRuntimeS *mkRt) |
additional runtime initialization function …
Every thread get a thread-specifig runtime and this runtime can be initialized with this function.
Definition at line 11629 of file LibMkKernel_mk.h.
MK_EXTERN void libmkkernel::MkRuntimeCallbackAdd | ( | struct MkRuntimeCallbackS * | cbdata, |
MK_RT | mkrt, | ||
MkRuntimeInitF | rt_callback, | ||
MK_STRN | ident ) |
add a callback to the runtime …
The callback is used to initialize local runtime-attributes per thread. This initialization is used to do the following tasks:
Every type is "thread-local" because every type has the type-(thread)-local memory-allocator located at MkTypeS::objalloc→MkAllocDefS::alloc_data and the type-local alloc-callbacks :
The memory-allocator is thread-local because the cache is thread-local including the predefined objects.
read more at MkTypeCreate
MK_EXTERN void libmkkernel::MkRuntimeCallbackDel | ( | struct MkRuntimeCallbackS * | cbdata | ) |
delete a callback from the runtime …
|
inline |
return a initialized MkRuntimeRLS …
Definition at line 11748 of file LibMkKernel_mk.h.
MK_EXTERN_DATA MkThreadLocal struct MkRuntimeS libmkkernel::MkRuntimeRLS |
RLS …
this is the runtime defined as MkThreadLocal
Definition at line 11740 of file LibMkKernel_mk.h.