abumq / easyloggingpp

C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build with -DELPP_EXPERIMENTAL_ASYNC causes segment fault as ELPP macro return nullptr

sfzhang opened this issue · comments

When build easylogging++ with -DELPP_EXPERIMENTAL_ASYNC to enable async logging, Storage constructor will call m_asyncDispatchWorker->start() which creates a worker thread and join() it. Now the Storage constructor will not return until the worker thread finished and the global variable (el::base::type::StoragePointer elStorage(val)) defined by INITIALIZE_EASYLOGGINGPP macro is an unfinished-constructed std::shared_ptr. And the worker thread will call AsyncDispatchWorker::emptyQueue() which access ELPP macro causes segment fault as the global variable (el::base::type::StoragePointer elStorage(val)) is nullptr!