35 using namespace ::v8::internal;
40 { LockGuard<Mutex> lock_guard(&mutex);
42 { LockGuard<Mutex> lock_guard(&mutex);
47 TEST(LockGuardRecursiveMutex) {
48 RecursiveMutex recursive_mutex;
49 { LockGuard<RecursiveMutex> lock_guard(&recursive_mutex);
51 { LockGuard<RecursiveMutex> lock_guard1(&recursive_mutex);
52 LockGuard<RecursiveMutex> lock_guard2(&recursive_mutex);
59 { LockGuard<Mutex> lock_guard(lazy_mutex.Pointer());
61 { LockGuard<Mutex> lock_guard(lazy_mutex.Pointer());
66 TEST(LockGuardLazyRecursiveMutex) {
68 { LockGuard<RecursiveMutex> lock_guard(lazy_recursive_mutex.Pointer());
70 { LockGuard<RecursiveMutex> lock_guard1(lazy_recursive_mutex.Pointer());
71 LockGuard<RecursiveMutex> lock_guard2(lazy_recursive_mutex.Pointer());
97 TEST(MultipleRecursiveMutexes) {
98 RecursiveMutex recursive_mutex1;
99 RecursiveMutex recursive_mutex2;
101 recursive_mutex1.Lock();
102 recursive_mutex2.Lock();
103 CHECK(recursive_mutex1.TryLock());
104 CHECK(recursive_mutex2.TryLock());
105 recursive_mutex1.Unlock();
106 recursive_mutex1.Unlock();
107 recursive_mutex2.Unlock();
108 recursive_mutex2.Unlock();
110 recursive_mutex1.Lock();
111 CHECK(recursive_mutex1.TryLock());
112 recursive_mutex2.Lock();
113 CHECK(recursive_mutex2.TryLock());
114 recursive_mutex2.Unlock();
115 recursive_mutex1.Unlock();
116 recursive_mutex2.Unlock();
117 recursive_mutex1.Unlock();
#define LAZY_MUTEX_INITIALIZER
#define LAZY_RECURSIVE_MUTEX_INITIALIZER
LazyStaticInstance< Mutex, DefaultConstructTrait< Mutex >, ThreadSafeInitOnceTrait >::type LazyMutex
LazyStaticInstance< RecursiveMutex, DefaultConstructTrait< RecursiveMutex >, ThreadSafeInitOnceTrait >::type LazyRecursiveMutex