MkRuntimeC - The class known as mkrt or runtime is the main libmkkernel application environment … More...
Topics | |
MkRtExtC | |
MkRtExtS - extend the MkRuntimeC with a library specific feature … | |
MkRuntimeC_Class_C_API | |
MkRuntimeC - define the class … | |
MkRuntimeC_Interface_C_API | |
MkRuntimeC - The MkRuntimeRLS, a thread-local storage for application-global data … | |
MkRuntimeC_Config_C_API | |
MkRuntimeC - various functions to configure the MkRuntimeRLS (only C) … | |
MkRuntimeC_Info_C_API | |
MkRuntimeC - various functions to print information about the rt … | |
Data Structures | |
struct | MkRuntimeS |
The MkRuntimeS provide a per-thread environment for LibMkKernel … More... | |
MkRuntimeC - The class known as mkrt or runtime is the main libmkkernel application environment …
The runtime is automatically created as thread-local-storage at startup, so that each new thread receives a thread-specific runtime. Each instance of the thread has a link to the runtime it was created in:
MkOBJ_R(instance)
.objRt = MkObjectS::objRt--enable-thread
configure option of Nhi1Config
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_PARSER_RT | MK_RT_CALL |
no args | MK_RT_ARGS_ONLY | MK_PARSER_RT_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