common/mutex_debug: fix arm64 SIGBUS/segfault due to data race
The mutex_debugging_base::is_locked_by_me() member function was
experiencing random SIGBUS and segfault on ARM64 due to a data race on
the non-atomic locked_by member.
The racing occurs when:
- Thread A writes to locked_by during lock acquisition
- Thread B reads from locked_by in is_locked_by_me()
- These accesses happen concurrently without synchronization
On ARM64, std::thread::id (8 bytes when using libstdc++) writes/reads
are not atomic, causing the reader to potentially see partially written
or corrupted thread ID values, leading to undefined behavior in the
comparison operator.
Fix by making locked_by atomic and using proper memory ordering
in is_locked_by_me() to ensure synchronized access.