This is an archive of the discontinued LLVM Phabricator instance.

Replace debug mutexes with std::recursive_mutex.
Needs ReviewPublic

Authored by zturner on Jun 18 2014, 3:13 PM.

Details

Reviewers
dblaikie
rnk
Summary

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.

Diff Detail

Event Timeline

zturner updated this revision to Diff 10592.Jun 18 2014, 3:13 PM
zturner retitled this revision from to Replace debug mutexes with std::recursive_mutex..
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added reviewers: chandlerc, dblaikie, rnk.
zturner set the repository for this revision to rL LLVM.
zturner added a subscriber: Unknown Object (MLST).