Mutex supports reader access, OS blocking, spinning,
portable and smaller than BlockingMutex.
Overall it's supposed to be better than RWMutex/BlockingMutex.
Replace RWMutex/BlockingMutex with Mutex.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/sanitizer_common/sanitizer_mutex.h | ||
---|---|---|
345 | I think there are a few locations which rely on this constructor. It compiles, but Mutex's constructor takes MutexType and LINKER_INITIALIZED==MutexInvalid. % git grep 'BlockingMutex.*LINKER_INITIALIZED' compiler-rt/lib/asan/asan_globals.cpp:static BlockingMutex mu_for_globals(LINKER_INITIALIZED); compiler-rt/lib/asan/asan_report.cpp:static BlockingMutex error_message_buf_mutex(LINKER_INITIALIZED); compiler-rt/lib/asan/asan_stats.cpp:static BlockingMutex print_lock(LINKER_INITIALIZED); compiler-rt/lib/asan/asan_stats.cpp:static BlockingMutex dead_threads_stats_lock(LINKER_INITIALIZED); compiler-rt/lib/asan/asan_thread.cpp:static BlockingMutex mu_for_thread_context(LINKER_INITIALIZED); compiler-rt/lib/cfi/cfi.cpp:BlockingMutex shadow_update_lock(LINKER_INITIALIZED); compiler-rt/lib/cfi/cfi.cpp:static BlockingMutex interceptor_init_lock(LINKER_INITIALIZED); compiler-rt/lib/lsan/lsan_common.cpp:BlockingMutex global_mutex(LINKER_INITIALIZED); compiler-rt/lib/memprof/memprof_stats.cpp:static BlockingMutex print_lock(LINKER_INITIALIZED); compiler-rt/lib/memprof/memprof_stats.cpp:static BlockingMutex dead_threads_stats_lock(LINKER_INITIALIZED); compiler-rt/lib/memprof/memprof_thread.cpp:static BlockingMutex mu_for_thread_context(LINKER_INITIALIZED); compiler-rt/lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp: BlockingMutex setup_lock_ = BlockingMutex(LINKER_INITIALIZED); compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp: // BlockingMutex::BlockingMutex() : BlockingMutex(LINKER_INITIALIZED) {} compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:static BlockingMutex syslog_lock(LINKER_INITIALIZED); compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp:static BlockingMutex crashreporter_info_mutex(LINKER_INITIALIZED); compiler-rt/lib/sanitizer_common/tests/sanitizer_mutex_test.cpp: BlockingMutex *mtx = new(mtxmem) BlockingMutex(LINKER_INITIALIZED); compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cpp:static BlockingMutex tctx_allocator_lock(LINKER_INITIALIZED) The cleanest would probably to just change all them to use the default constructor which is now constexpr. |
compiler-rt/lib/sanitizer_common/sanitizer_mutex.h | ||
---|---|---|
345 | Very good point. |
compiler-rt/lib/sanitizer_common/sanitizer_mutex.h | ||
---|---|---|
375 | Perhaps turn this into a TODO / FIXME so it shows up in 'git grep TODO' and less likely to be forgotten. I assume this will disappear soon? ( s/Temporal/Temporary/, s/typedef's/typedefs/ ) |
compiler-rt/lib/sanitizer_common/sanitizer_mutex.h | ||
---|---|---|
375 |
Yes, I will resolve it once this change puts down root. |
I think there are a few locations which rely on this constructor. It compiles, but Mutex's constructor takes MutexType and LINKER_INITIALIZED==MutexInvalid.
The cleanest would probably to just change all them to use the default constructor which is now constexpr.