Use recursive mutex on log calls because some call arguments can themselves call the log. Caused actual deadlocks in recoll 1.23 GUI with high verbosity
This commit is contained in:
parent
35d92714d9
commit
13df29f01f
2 changed files with 4 additions and 4 deletions
|
@ -31,7 +31,7 @@ Logger::Logger(const std::string& fn)
|
||||||
bool Logger::reopen(const std::string& fn)
|
bool Logger::reopen(const std::string& fn)
|
||||||
{
|
{
|
||||||
#if LOGGER_THREADSAFE
|
#if LOGGER_THREADSAFE
|
||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||||
#endif
|
#endif
|
||||||
if (!fn.empty()) {
|
if (!fn.empty()) {
|
||||||
m_fn = fn;
|
m_fn = fn;
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LOGGER_THREADSAFE
|
#if LOGGER_THREADSAFE
|
||||||
std::mutex& getmutex() {
|
std::recursive_mutex& getmutex() {
|
||||||
return m_mutex;
|
return m_mutex;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,7 +84,7 @@ private:
|
||||||
std::string m_fn;
|
std::string m_fn;
|
||||||
std::ofstream m_stream;
|
std::ofstream m_stream;
|
||||||
#if LOGGER_THREADSAFE
|
#if LOGGER_THREADSAFE
|
||||||
std::mutex m_mutex;
|
std::recursive_mutex m_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Logger(const std::string& fn);
|
Logger(const std::string& fn);
|
||||||
|
@ -96,7 +96,7 @@ private:
|
||||||
|
|
||||||
#if LOGGER_THREADSAFE
|
#if LOGGER_THREADSAFE
|
||||||
#define LOGGER_LOCK \
|
#define LOGGER_LOCK \
|
||||||
std::unique_lock<std::mutex> lock(Logger::getTheLog("")->getmutex())
|
std::unique_lock<std::recursive_mutex> lock(Logger::getTheLog("")->getmutex())
|
||||||
#else
|
#else
|
||||||
#define LOGGER_LOCK
|
#define LOGGER_LOCK
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue