C++ logging library. It is powerful, supports asynchronous low latency, 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.
MIT License
3.79k
stars
926
forks
source link
Deadlock with ELPP_AS_DLL and ELPP_THREAD_SAFE defined on Windows 7 (and lower) #258
To compile it you need to fix linker error firstly. I add comment on #150
Looks like the problem is with using std::mutex (possibly call to ::CreateMutex()) as global variable.
Here are few links, that has such problem with using std::mutex inside ::DllMain():
We can safely undefine ELPP_USE_STD_THREADING to use CRITICAL_SECTION as you suggested. Leaving this open for other suggestions using std::mutex (or to later have a look at links in detail)
How to reproduce (v 9.80):
(solution for Microsoft Visual Studio 2013) Compile an run it on Windows 7. Application will stuck and you will not see any console output.
Looks like the problem is with using std::mutex (possibly call to
::CreateMutex()
) as global variable. Here are few links, that has such problem with usingstd::mutex
inside::DllMain()
:The simplest solution is to use
CRITICAL_SECTION
insteadstd::mutex
. So, in case of Windows, I fix the problem by usingclass Mutex
:I do not see such problem on Windows 8 (8.1). And found it on Windows 7 that is running on VM,
Thanks