Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: test/cctest/test-platform-linux.cc

Issue 23625003: Cleanup Mutex and related classes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-mutex.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-platform-linux.cc
diff --git a/test/cctest/test-platform-linux.cc b/test/cctest/test-platform-linux.cc
index 6bb2902f41097825e0c5dc130dfd1628598cc295..7347aaceb464caf3001ff787993d14849587b2de 100644
--- a/test/cctest/test-platform-linux.cc
+++ b/test/cctest/test-platform-linux.cc
@@ -52,18 +52,16 @@ static void LoopIncrement(Mutex* mutex, int rem) {
int count = 0;
int last_count = -1;
do {
- CHECK_EQ(0, mutex->Lock());
+ LockGuard<Mutex> lock_guard(mutex);
count = busy_lock_counter;
- CHECK_EQ(0, mutex->Unlock());
yield();
} while (count % 2 == rem && count < kLockCounterLimit);
if (count >= kLockCounterLimit) break;
- CHECK_EQ(0, mutex->Lock());
+ LockGuard<Mutex> lock_guard(mutex);
CHECK_EQ(count, busy_lock_counter);
CHECK(last_count == -1 || count == last_count + 1);
busy_lock_counter++;
last_count = count;
- CHECK_EQ(0, mutex->Unlock());
yield();
}
}
@@ -79,15 +77,14 @@ static void* RunTestBusyLock(void* arg) {
// increment a variable.
TEST(BusyLock) {
pthread_t other;
- Mutex* mutex = OS::CreateMutex();
+ Mutex mutex;
int thread_created = pthread_create(&other,
NULL,
&RunTestBusyLock,
- mutex);
+ &mutex);
CHECK_EQ(0, thread_created);
- LoopIncrement(mutex, 1);
+ LoopIncrement(&mutex, 1);
pthread_join(other, NULL);
- delete mutex;
}
« no previous file with comments | « test/cctest/test-mutex.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698