File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ struct LogConfig
112112 std::ostream* log_stream;
113113 SRT_LOG_HANDLER_FN* loghandler_fn;
114114 void * loghandler_opaque;
115- srt::sync::Mutex mutex;
115+ mutable srt::sync::Mutex mutex;
116116 int flags;
117117
118118 LogConfig (const fa_bitset_t & efa,
@@ -132,10 +132,10 @@ struct LogConfig
132132 }
133133
134134 SRT_ATTR_ACQUIRE (mutex)
135- void lock () { mutex.lock (); }
135+ void lock () const { mutex.lock (); }
136136
137137 SRT_ATTR_RELEASE (mutex)
138- void unlock () { mutex.unlock (); }
138+ void unlock () const { mutex.unlock (); }
139139};
140140
141141// The LogDispatcher class represents the object that is responsible for
@@ -424,8 +424,10 @@ inline bool LogDispatcher::CheckEnabled()
424424 // when the enabler check is tested here. Worst case, the log
425425 // will be printed just a moment after it was turned off.
426426 const LogConfig* config = src_config; // to enforce using const operator[]
427+ config->lock ();
427428 int configured_enabled_fa = config->enabled_fa [fa];
428429 int configured_maxlevel = config->max_level ;
430+ config->unlock ();
429431
430432 return configured_enabled_fa && level <= configured_maxlevel;
431433}
You can’t perform that action at this time.
0 commit comments