MkKernel PACKAGE - Setup und Cleanup the jvmkkernel … More...
Functions | |
void | MkSetup (void) |
setup jvmkkernel internal memory … | |
void | MkCleanup (void) |
cleanup jvmkkernel internal memory … | |
bool | MkHasThread (void) |
bool | MkHasFork (void) |
Variables | |
bool | MkCleanupActive |
signal that code was triggert by MkCleanup | |
MkKernel PACKAGE - Setup und Cleanup the jvmkkernel …
Initializing a jvmkkernel library depends on the Target-Programming-Language (TPL) and the specific nature of the Programming-Language-Micro-Kernel (PLMK).
In general it is required to call a Setup style funtion as FIRST command because of:
If more than one META library is called only the toplevel Setup is required:
A new jvmkkernel library is initialized with Setup and released again with Cleanup. Both functions are automatically called upon loading and unloading of the shared library.
Example: Definition (C) of the jvmkkernel library startup functions
In the Programming-Language-Micro-Kernel (PLMK), a type is defined for each thread, which means that the new jvmkkernel library must be known when the thread starts. This is not a problem as long as the external jvmkkernel library is linked to the application. However, if dlopen
is used to load the jvmkkernel library, the current restriction is that the new data type from the jvmkkernel library has not been defined in all existing threads.
The point in time when a library is loaded depends heavily on the programming language used.
package require myLib
) is made, which happens fairly close to the start of the program but is not guaranteed.To avoid all the problems call the Setup directly at the start of the main program.
Example: Start of the LcConfigServer
application from the example/cs
directory
LcConfigServer
application is that the libmkkernel and libmqmsgque libraries are loaded very early, at startup, and the liblcconfig very late, only on request.void MkCleanup | ( | void | ) |
cleanup jvmkkernel internal memory …
/
/noop [MkCleanup] Cleanup will only be recognized once and will be ignored if not called in the same thread as Setup. After a call to Setup the call to MkCleanup is possible again.
gcc: __attribute__ ((cleanup(XXX)))
is called when unloading the library.bool MkHasFork | ( | void | ) |
bool MkHasThread | ( | void | ) |
void MkSetup | ( | void | ) |
setup jvmkkernel internal memory …
Setup will only be recognized once, additional call's will be ignored until a Cleanup is called.
gcc: __attribute__ ((constructor(XXX)))
is called when loading the library.dlopen
and additionally uses threads, a manual call to Setup very early at startup is required to enforce the correct order of type declarations.
|
extern |
signal that code was triggert by MkCleanup