It is currently impossible to call debug methods such as AssertLock(Not)Held on a thread without running into undefined behavior, unless a lock was pushed on the stack in this thread.
Initializing the global lockstack seems to fix both issues.
It is currently impossible to call debug methods such as AssertLock(Not)Held on a thread without running into undefined behavior, unless a lock was pushed on the stack in this thread.
Initializing the global lockstack seems to fix both issues.
Fixes: #13263
If it's a static variable initialized at startup, maybe do away with the pointer?
74 | @@ -75,7 +75,7 @@ struct LockData { 75 | std::mutex dd_mutex; 76 | } static lockdata; 77 | 78 | -static thread_local std::unique_ptr<LockStack> lockstack; 79 | +static thread_local std::unique_ptr<LockStack> lockstack{new LockStack};
I guess MakeUnique/std::make_unique is not that relevant here.
Also, const static?
utACK fa9da85, statically allocated does look better. Not sure about the new variable name - is a static variable also global?
@promag My rule of thumb is "everything is a global unless it is a class member". Couldn't yet find any issues with that rule :p
utACK fa9da85
Thread-local is a very special kind of global, but as for variable naming it's fine, it has global scope from the perspective of the compiler.
utACK fa9da85b7cc759d06bc24854be2bad0ea87b6006