Index: runtime/vm/os_thread_fuchsia.cc |
diff --git a/runtime/vm/os_thread_fuchsia.cc b/runtime/vm/os_thread_fuchsia.cc |
index 5a94f4752e9e5ef32eebd8b6b2a74c7e36e0c204..2deaa933b0bb9db35146f20e67f14d260bb7351b 100644 |
--- a/runtime/vm/os_thread_fuchsia.cc |
+++ b/runtime/vm/os_thread_fuchsia.cc |
@@ -25,7 +25,6 @@ namespace dart { |
FATAL1("pthread error: %d", result); \ |
} |
- |
#if defined(DEBUG) |
#define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result) |
#else |
@@ -33,7 +32,6 @@ namespace dart { |
#define ASSERT_PTHREAD_SUCCESS(result) ASSERT(result == 0) |
#endif |
- |
#ifdef DEBUG |
#define RETURN_ON_PTHREAD_FAILURE(result) \ |
if (result != 0) { \ |
@@ -45,7 +43,6 @@ namespace dart { |
if (result != 0) return result; |
#endif |
- |
static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { |
// time in nanoseconds. |
mx_time_t now = mx_time_get(MX_CLOCK_MONOTONIC); |
@@ -57,7 +54,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) { |
ts->tv_nsec = nanos; |
} |
- |
class ThreadStartData { |
public: |
ThreadStartData(const char* name, |
@@ -77,7 +73,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. |
@@ -101,7 +96,6 @@ static void* ThreadStart(void* data_ptr) { |
return NULL; |
} |
- |
int OSThread::Start(const char* name, |
ThreadStartFunction function, |
uword parameter) { |
@@ -124,12 +118,10 @@ int OSThread::Start(const char* name, |
return 0; |
} |
- |
const ThreadId OSThread::kInvalidThreadId = MX_KOID_INVALID; |
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); |
@@ -138,27 +130,23 @@ 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() { |
mx_info_handle_basic_t info; |
mx_handle_t thread_handle = thrd_get_mx_handle(thrd_current()); |
@@ -171,14 +159,12 @@ ThreadId OSThread::GetCurrentThreadId() { |
return info.koid; |
} |
- |
#ifndef PRODUCT |
ThreadId OSThread::GetCurrentThreadTraceId() { |
return pthread_self(); |
} |
#endif // PRODUCT |
- |
ThreadJoinId OSThread::GetCurrentThreadJoinId(OSThread* thread) { |
ASSERT(thread != NULL); |
// Make sure we're filling in the join id for the current thread. |
@@ -192,34 +178,28 @@ 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) { |
return false; |
} |
- |
Mutex::Mutex() { |
pthread_mutexattr_t attr; |
int result = pthread_mutexattr_init(&attr); |
@@ -243,7 +223,6 @@ Mutex::Mutex() { |
#endif // defined(DEBUG) |
} |
- |
Mutex::~Mutex() { |
int result = pthread_mutex_destroy(data_.mutex()); |
// Verify that the pthread_mutex was destroyed. |
@@ -255,7 +234,6 @@ Mutex::~Mutex() { |
#endif // defined(DEBUG) |
} |
- |
void Mutex::Lock() { |
int result = pthread_mutex_lock(data_.mutex()); |
// Specifically check for dead lock to help debugging. |
@@ -267,7 +245,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. |
@@ -282,7 +259,6 @@ bool Mutex::TryLock() { |
return true; |
} |
- |
void Mutex::Unlock() { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -295,7 +271,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); |
@@ -331,7 +306,6 @@ Monitor::Monitor() { |
#endif // defined(DEBUG) |
} |
- |
Monitor::~Monitor() { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -345,7 +319,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. |
@@ -361,7 +334,6 @@ bool Monitor::TryEnter() { |
return true; |
} |
- |
void Monitor::Enter() { |
int result = pthread_mutex_lock(data_.mutex()); |
VALIDATE_PTHREAD_RESULT(result); |
@@ -373,7 +345,6 @@ void Monitor::Enter() { |
#endif // defined(DEBUG) |
} |
- |
void Monitor::Exit() { |
#if defined(DEBUG) |
// When running with assertions enabled we track the owner. |
@@ -385,13 +356,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. |
@@ -424,7 +393,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) { |
return retval; |
} |
- |
void Monitor::Notify() { |
// When running with assertions enabled we track the owner. |
ASSERT(IsOwnedByCurrentThread()); |
@@ -432,7 +400,6 @@ void Monitor::Notify() { |
VALIDATE_PTHREAD_RESULT(result); |
} |
- |
void Monitor::NotifyAll() { |
// When running with assertions enabled we track the owner. |
ASSERT(IsOwnedByCurrentThread()); |