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

Unified Diff: runtime/bin/thread_macos.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 | « runtime/bin/thread_macos.h ('k') | runtime/bin/thread_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/thread_macos.cc
diff --git a/runtime/bin/thread_macos.cc b/runtime/bin/thread_macos.cc
index d8df64a3e0c620d2945dfcccb5a53368991fceed..249a4760378408239a7cf5125f440ff3f8f96ac9 100644
--- a/runtime/bin/thread_macos.cc
+++ b/runtime/bin/thread_macos.cc
@@ -33,7 +33,6 @@ namespace bin {
FATAL2("pthread error: %d (%s)", result, error_message); \
}
-
#ifdef DEBUG
#define RETURN_ON_PTHREAD_FAILURE(result) \
if (result != 0) { \
@@ -51,7 +50,6 @@ namespace bin {
}
#endif
-
class ThreadStartData {
public:
ThreadStartData(Thread::ThreadStartFunction function, uword parameter)
@@ -67,7 +65,6 @@ class ThreadStartData {
DISALLOW_COPY_AND_ASSIGN(ThreadStartData);
};
-
// Dispatch to the thread start function provided by the caller. This trampoline
// is used to ensure that the thread is properly destroyed if the thread just
// exits.
@@ -84,7 +81,6 @@ static void* ThreadStart(void* data_ptr) {
return NULL;
}
-
int Thread::Start(ThreadStartFunction function, uword parameter) {
pthread_attr_t attr;
int result = pthread_attr_init(&attr);
@@ -108,7 +104,6 @@ int Thread::Start(ThreadStartFunction function, uword parameter) {
return 0;
}
-
const ThreadLocalKey Thread::kUnsetThreadLocalKey =
static_cast<pthread_key_t>(-1);
const ThreadId Thread::kInvalidThreadId = reinterpret_cast<ThreadId>(NULL);
@@ -121,48 +116,40 @@ ThreadLocalKey Thread::CreateThreadLocal() {
return key;
}
-
void Thread::DeleteThreadLocal(ThreadLocalKey key) {
ASSERT(key != kUnsetThreadLocalKey);
int result = pthread_key_delete(key);
VALIDATE_PTHREAD_RESULT(result);
}
-
void Thread::SetThreadLocal(ThreadLocalKey key, uword value) {
ASSERT(key != kUnsetThreadLocalKey);
int result = pthread_setspecific(key, reinterpret_cast<void*>(value));
VALIDATE_PTHREAD_RESULT(result);
}
-
intptr_t Thread::GetMaxStackSize() {
const int kStackSize = (128 * kWordSize * KB);
return kStackSize;
}
-
ThreadId Thread::GetCurrentThreadId() {
return pthread_self();
}
-
intptr_t Thread::ThreadIdToIntPtr(ThreadId id) {
ASSERT(sizeof(id) == sizeof(intptr_t));
return reinterpret_cast<intptr_t>(id);
}
-
bool Thread::Compare(ThreadId a, ThreadId b) {
return (pthread_equal(a, b) != 0);
}
-
void Thread::InitOnce() {
// Nothing to be done.
}
-
Mutex::Mutex() {
pthread_mutexattr_t attr;
int result = pthread_mutexattr_init(&attr);
@@ -181,14 +168,12 @@ Mutex::Mutex() {
VALIDATE_PTHREAD_RESULT(result);
}
-
Mutex::~Mutex() {
int result = pthread_mutex_destroy(data_.mutex());
// Verify that the pthread_mutex was destroyed.
VALIDATE_PTHREAD_RESULT(result);
}
-
void Mutex::Lock() {
int result = pthread_mutex_lock(data_.mutex());
// Specifically check for dead lock to help debugging.
@@ -197,7 +182,6 @@ void Mutex::Lock() {
// TODO(iposva): Do we need to track lock owners?
}
-
bool Mutex::TryLock() {
int result = pthread_mutex_trylock(data_.mutex());
// Return false if the lock is busy and locking failed.
@@ -209,7 +193,6 @@ bool Mutex::TryLock() {
return true;
}
-
void Mutex::Unlock() {
// TODO(iposva): Do we need to track lock owners?
int result = pthread_mutex_unlock(data_.mutex());
@@ -218,7 +201,6 @@ void Mutex::Unlock() {
ASSERT(result == 0); // Verify no other errors.
}
-
Monitor::Monitor() {
pthread_mutexattr_t attr;
int result = pthread_mutexattr_init(&attr);
@@ -239,7 +221,6 @@ Monitor::Monitor() {
VALIDATE_PTHREAD_RESULT(result);
}
-
Monitor::~Monitor() {
int result = pthread_mutex_destroy(data_.mutex());
VALIDATE_PTHREAD_RESULT(result);
@@ -248,26 +229,22 @@ Monitor::~Monitor() {
VALIDATE_PTHREAD_RESULT(result);
}
-
void Monitor::Enter() {
int result = pthread_mutex_lock(data_.mutex());
VALIDATE_PTHREAD_RESULT(result);
// TODO(iposva): Do we need to track lock owners?
}
-
void Monitor::Exit() {
// TODO(iposva): Do we need to track lock owners?
int result = pthread_mutex_unlock(data_.mutex());
VALIDATE_PTHREAD_RESULT(result);
}
-
Monitor::WaitResult Monitor::Wait(int64_t millis) {
return WaitMicros(millis * kMicrosecondsPerMillisecond);
}
-
Monitor::WaitResult Monitor::WaitMicros(int64_t micros) {
// TODO(iposva): Do we need to track lock owners?
Monitor::WaitResult retval = kNotified;
@@ -296,14 +273,12 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) {
return retval;
}
-
void Monitor::Notify() {
// TODO(iposva): Do we need to track lock owners?
int result = pthread_cond_signal(data_.cond());
VALIDATE_PTHREAD_RESULT(result);
}
-
void Monitor::NotifyAll() {
// TODO(iposva): Do we need to track lock owners?
int result = pthread_cond_broadcast(data_.cond());
« no previous file with comments | « runtime/bin/thread_macos.h ('k') | runtime/bin/thread_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698