This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Change llvm::sys::Mutex implementation to use STL-provided mutexes
AbandonedPublic

Authored by zturner on May 29 2014, 1:33 PM.

Details

Reviewers
rnk
Summary

Change llvm::sys::Mutex implementation to use std::mutex and std::recursive_mutex.

This patch deletes the platform specific mutex implementations, and delegates to the underlying STL implementation. Because STL mutex and recursive_mutex are implemented as separate classes, it is no longer possible to specify as a runtime param whether a recursive mutex is desired, and instead the decision must be made at compile time.

As part of this refactor, the ScopedLock class is deleted in favor of MutexGuard, which provides equivalent functionality.

To make reviewing easier, you can refer to the following table of equivalences in the format (old_type -> new_type)

SmartMutex<true>([true]) -> RecursiveDebugMutex

SmartMutex<false>([true]) -> RecursiveMutex
sys::Mutex -> SmartMutex<false>() -> RecursiveMutex

SmartMutex<true>(false) -> NonRecursiveDebugMutex
SmartMutex<false>(false) -> NonRecursiveMutex

Diff Detail

Event Timeline

zturner updated this revision to Diff 9930.May 29 2014, 1:33 PM
zturner retitled this revision from to Change llvm::sys::Mutex implementation to use STL-provided mutexes..
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added a reviewer: rnk.
zturner added a subscriber: Unknown Object (MLST).
zturner updated this object.May 29 2014, 1:39 PM
zturner updated this revision to Diff 9932.May 29 2014, 2:02 PM
zturner retitled this revision from Change llvm::sys::Mutex implementation to use STL-provided mutexes. to [llvm] Change llvm::sys::Mutex implementation to use STL-provided mutexes.

Fix compiler errors on linux.

zturner abandoned this revision.Jun 5 2014, 10:00 AM

Going to resubmit this as a new patch, now that the issues are resolved.