Fix filters_rwlock initialization race condition

Add static initialization PTHREAD_RWLOCK_INITIALIZER to filters_rwlock
in debug.cpp to prevent race condition where proxy_debug() is called
before init_debug_struct() initializes the rwlock.

This fixes Valgrind errors in filter_debug_entry() where threads were
accessing an uninitialized rwlock.
v3.0-test0213
Rene Cannao 5 days ago
parent 3c85c593cf
commit 941e6b7320

@ -18,7 +18,7 @@ using std::unordered_map;
__thread unsigned long long pretime=0;
static pthread_mutex_t debug_mutex;
static pthread_rwlock_t filters_rwlock;
static pthread_rwlock_t filters_rwlock = PTHREAD_RWLOCK_INITIALIZER;
static SQLite3DB * debugdb_disk = NULL;
sqlite3_stmt *statement1=NULL;
static stmt_unique_ptr statement1_unique {};

Loading…
Cancel
Save