Index: runtime/vm/os_thread_linux.cc |
diff --git a/runtime/vm/os_thread_linux.cc b/runtime/vm/os_thread_linux.cc |
index 60e33229ce4f89de76381bfaaeb0a2a2b257bf3e..3b5239da5f60f28164dd2a1dec212cab5f416758 100644 |
--- a/runtime/vm/os_thread_linux.cc |
+++ b/runtime/vm/os_thread_linux.cc |
@@ -30,7 +30,6 @@ namespace dart { |
Utils::StrError(result, error_buf, kBufferSize)); \ |
} |
- |
#if defined(DEBUG) |
#define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) |
#else |
@@ -38,7 +37,6 @@ namespace dart { |
#define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) |
#endif |
- |
#ifdef DEBUG |
#define RETURN_ON_PTHREAD_FAILURE(result) \ |
if (result != 0) { \ |
@@ -53,7 +51,6 @@ namespace dart { |
if (result != 0) return result; |
#endif |
- |
static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { |
int64_t secs = micros / kMicrosecondsPerSecond; |
int64_t nanos = |
@@ -68,7 +65,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { |
} |
} |
- |
class ThreadStartData { |
public: |
ThreadStartData(const char* name, |
@@ -88,7 +84,6 @@ class ThreadStartData { |
DISALLOW_COPY_AND_ASSIGN(ThreadStartData); |
}; |
- |
// Spawned threads inherit their spawner's signal mask. We sometimes spawn |
// threads for running Dart code from a thread that is blocking SIGPROF. |
// This function explicitly unblocks SIGPROF so the profiler continues to |
@@ -103,7 +98,6 @@ static void UnblockSIGPROF() { |
ASSERT(!CHECK_IS_BLOCKING(SIGPROF)); |
} |
- |
// 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. |
@@ -128,7 +122,6 @@ static void* ThreadStart(void* data_ptr) { |
return NULL; |
} |
- |
int OSThread::Start(const char* name, |
ThreadStartFunction function, |
uword parameter) { |
@@ -151,12 +144,10 @@ int OSThread::Start(const char* name, |
return 0; |
} |
- |
const ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); |
const ThreadJoinId OSThread::kInvalidThreadJoinId = |
static_cast<ThreadJoinId>(0); |
- |
ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { |
pthread_key_t key = kUnsetThreadLocalKey; |
int result = pthread_key_create(&key, destructor); |
@@ -165,39 +156,33 @@ ThreadLocalKey OSThread::CreateThreadLocal(ThreadDestructor destructor) { |
return key; |
} |
- |
void OSThread::DeleteThreadLocal(ThreadLocalKey key) { |
ASSERT(key != kUnsetThreadLocalKey); |
int result = pthread_key_delete(key); |
VALIDATE_PTHREAD_RESULT(result); |
} |
- |
void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { |
ASSERT(key != kUnsetThreadLocalKey); |
int result = pthread_setspecific(key, reinterpret_cast<void*>(value)); |
VALIDATE_PTHREAD_RESULT(result); |
} |
- |
intptr_t OSThread::GetMaxStackSize() { |
const int kStackSize = (128 * kWordSize * KB); |
return kStackSize; |
} |
- |
ThreadId OSThread::GetCurrentThreadId() { |
return pthread_self(); |
} |
- |
#ifndef PRODUCT |
ThreadId OSThread::GetCurrentThreadTraceId() { |
return syscall(__NR_gettid); |
} |
#endif // PRODUCT |
- |
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { |
ASSERT(thread != NULL); |
// Make sure we're filling in the join id for the current thread. |
@@ -211,29 +196,24 @@ ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { |
return id; |
} |
- |
void OSThread::Join(ThreadJoinId id) { |
int result = pthread_join(id, NULL); |
ASSERT(result == 0); |
} |
- |
intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { |
ASSERT(sizeof(id) == sizeof(intptr_t)); |
return static_cast<intptr_t>(id); |
} |
- |
ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { |
return static_cast<ThreadId>(id); |
} |
- |
bool OSThread::Compare(ThreadId a, ThreadId b) { |
return pthread_equal(a, b) != 0; |
} |
- |
bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { |
pthread_attr_t attr; |
if (pthread_getattr_np(pthread_self(), &attr)) { |
@@ -253,7 +233,6 @@ bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { |
return true; |
} |
- |
Mutex::Mutex() { |
pthread_mutexattr_t attr; |
int result = pthread_mutexattr_init(&attr); |
@@ -277,7 +256,6 @@ Mutex::Mutex() { |
#endif // defined(DEBUG) |
} |
- |
Mutex::~Mutex() { |
int result = pthread_mutex_destroy(data_.mutex()); |
// Verify that the pthread_mutex was destroyed. |
@@ -289,7 +267,6 @@ Mutex::~Mutex() { |
#endif // defined(DEBUG) |
} |
- |
void Mutex::Lock() { |
int result = pthread_mutex_lock(data_.mutex()); |
// Specifically check for dead lock to help debugging. |
@@ -301,7 +278,6 @@ void Mutex::Lock() { |
#endif // defined(DEBUG) |
} |
- |
bool Mutex::TryLock() { |
int result = pthread_mutex_trylock(data_.mutex()); |
// Return false if the lock is busy and locking failed. |
@@ -316,7 +292,6 @@ bool Mutex::TryLock() { |
return true; |
} |
- |
void Mutex::Unlock() { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -329,7 +304,6 @@ void Mutex::Unlock() { |
ASSERT_PTHREAD_SUCCESS(result); // Verify no other errors. |
} |
- |
Monitor::Monitor() { |
pthread_mutexattr_t mutex_attr; |
int result = pthread_mutexattr_init(&mutex_attr); |
@@ -365,7 +339,6 @@ Monitor::Monitor() { |
#endif // defined(DEBUG) |
} |
- |
Monitor::~Monitor() { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -379,7 +352,6 @@ Monitor::~Monitor() { |
VALIDATE_PTHREAD_RESULT(result); |
} |
- |
bool Monitor::TryEnter() { |
int result = pthread_mutex_trylock(data_.mutex()); |
// Return false if the lock is busy and locking failed. |
@@ -395,7 +367,6 @@ bool Monitor::TryEnter() { |
return true; |
} |
- |
void Monitor::Enter() { |
int result = pthread_mutex_lock(data_.mutex()); |
VALIDATE_PTHREAD_RESULT(result); |
@@ -407,7 +378,6 @@ void Monitor::Enter() { |
#endif // defined(DEBUG) |
} |
- |
void Monitor::Exit() { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -419,13 +389,11 @@ void Monitor::Exit() { |
VALIDATE_PTHREAD_RESULT(result); |
} |
- |
Monitor::WaitResult Monitor::Wait(int64_t millis) { |
Monitor::WaitResult retval = WaitMicros(millis * kMicrosecondsPerMillisecond); |
return retval; |
} |
- |
Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -458,7 +426,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { |
return retval; |
} |
- |
void Monitor::Notify() { |
// When running with assertions enabled we track the owner. |
ASSERT(IsOwnedByCurrentThread()); |
@@ -466,7 +433,6 @@ void Monitor::Notify() { |
VALIDATE_PTHREAD_RESULT(result); |
} |
- |
void Monitor::NotifyAll() { |
// When running with assertions enabled we track the owner. |
ASSERT(IsOwnedByCurrentThread()); |