proxygen
|
#include <folly/LockTraits.h>
#include <folly/LockTraitsBoost.h>
#include <mutex>
#include <folly/SharedMutex.h>
#include <folly/SpinLock.h>
#include <folly/portability/GTest.h>
#include <folly/synchronization/RWSpinLock.h>
Go to the source code of this file.
Classes | |
class | FakeAllPowerfulAssertingMutex |
Functions | |
TEST (LockTraits, std_mutex) | |
TEST (LockTraits, SharedMutex) | |
TEST (LockTraits, SpinLock) | |
TEST (LockTraits, RWSpinLock) | |
TEST (LockTraits, boost_mutex) | |
TEST (LockTraits, boost_recursive_mutex) | |
TEST (LockTraits, LockPolicy) | |
TEST (LockTraits, LockPolicyTimed) | |
TEST (LockTraits, LockPolicyCompatibilities) | |
Variables | |
static constexpr auto | one_ms = std::chrono::milliseconds(1) |
TEST | ( | LockTraits | , |
std_mutex | |||
) |
Definition at line 107 of file LockTraitsTest.cpp.
References folly::detail::lock(), and mutex.
TEST | ( | LockTraits | , |
SharedMutex | |||
) |
Definition at line 118 of file LockTraitsTest.cpp.
References EXPECT_FALSE, folly::detail::lock(), mutex, and one_ms.
TEST | ( | LockTraits | , |
SpinLock | |||
) |
Definition at line 182 of file LockTraitsTest.cpp.
References folly::detail::lock(), and mutex.
TEST | ( | LockTraits | , |
RWSpinLock | |||
) |
Definition at line 194 of file LockTraitsTest.cpp.
References folly::detail::lock(), and mutex.
TEST | ( | LockTraits | , |
boost_mutex | |||
) |
Definition at line 210 of file LockTraitsTest.cpp.
References folly::detail::lock(), and mutex.
TEST | ( | LockTraits | , |
boost_recursive_mutex | |||
) |
Definition at line 221 of file LockTraitsTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, folly::detail::lock(), mutex, and folly::TEST().
TEST | ( | LockTraits | , |
LockPolicy | |||
) |
Chain the asserts from the previous test to the next lock, unlock or upgrade method calls. Each making sure that the previous was correct.
Definition at line 304 of file LockTraitsTest.cpp.
References EXPECT_EQ, folly::LockPolicyUpgrade::lock(), folly::LockPolicyFromUpgradeToExclusive::lock(), folly::LockPolicyFromExclusiveToUpgrade::lock(), folly::LockPolicyFromUpgradeToShared::lock(), folly::LockPolicyFromExclusiveToShared::lock(), mutex, Mutex, folly::detail::UnlockPolicyExclusive< LockTraits >::unlock(), folly::detail::UnlockPolicyShared< LockTraits >::unlock(), and folly::detail::UnlockPolicyUpgrade< LockTraits >::unlock().
TEST | ( | LockTraits | , |
LockPolicyTimed | |||
) |
Similar to the test above but tests the timed version of the updates
Definition at line 344 of file LockTraitsTest.cpp.
References EXPECT_TRUE, mutex, Mutex, one_ms, folly::LockPolicyUpgrade::try_lock_for(), folly::LockPolicyFromUpgradeToExclusive::try_lock_for(), folly::LockPolicyFromExclusiveToUpgrade::try_lock_for(), folly::LockPolicyFromUpgradeToShared::try_lock_for(), folly::LockPolicyFromExclusiveToShared::try_lock_for(), and folly::detail::UnlockPolicyUpgrade< LockTraits >::unlock().
TEST | ( | LockTraits | , |
LockPolicyCompatibilities | |||
) |
Test compatibility of the different lock policies
This should be correct because the compatibilities here are used to determine whether or not the different LockedPtr instances can be moved from each other
Definition at line 384 of file LockTraitsTest.cpp.
References EXPECT_TRUE, and folly::value().
|
static |
Definition at line 28 of file LockTraitsTest.cpp.
Referenced by TEST().