Thread safety in to memory hooks, initialization which will occure in all cases.

Basic problem with initialization is that the initial function is not called automatically in all cases. So in all hooks need to be checks if the initialization is already completed and if it is not than initialization must be called.
Second obstacle are memory allocation calls in dlsym function in some memory models (pthread and sou on) and memory allocation call in backtrace function. To solve second problem new atomic state is presented and in this state the function which can be used by dlsym and backtrace function return NULL.

How to ensure the thread safety in case of initialization? Threi is easy anser to it. Recursive lock can be used and ony one thread will have acces to memory hooks in one time while initialization.
Malloc function are thread safe from beginning but our logging is not so storeDataChunk function has lock from atomic inside.