[PATCH] Replace debug mutexes with std::recursive_mutex.

Zachary Turner zturner at google.com
Wed Jun 18 15:13:35 PDT 2014


Hi chandlerc, dblaikie, rnk,

This patch replaces all occurrences of SmartMutex<true> with an STL mutex.

This introduces a minor behavioral change.  Previously, in situations where LLVM_ENABLE_THREADS was false, or where llvm_start_multithreaded() had not been called, SmartMutex<true> ended up a no-op.  With this change, a mutex will actually be acquired, even for single-threaded code.

This has been discussed previously on the mailing list and there was some consensus that this was OK as the time required to acquire an uncontended mutex is extremely low on any sane mutex implementation, but I'm posting it again for wider review.  It's worth pointing out that a test compiling a very large TU with and without the patch shows no noticeable difference in wall-clock time.

http://reviews.llvm.org/D4200

Files:
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/IR/LeakDetector.cpp
  lib/IR/LegacyPassManager.cpp
  lib/Support/DynamicLibrary.cpp
  lib/Support/PluginLoader.cpp
  lib/Support/Statistic.cpp
  lib/Support/Timer.cpp
  lib/Support/Windows/DynamicLibrary.inc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4200.10592.patch
Type: text/x-patch
Size: 12007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140618/876b130d/attachment.bin>


More information about the llvm-commits mailing list