| Index: runtime/vm/os_thread_android.cc
|
| diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc
|
| index 36f910bf7da5a98ce55cd49900e20e5e995167ed..dc09b5eea93f9d75eb9789884cfe1ff0e04570db 100644
|
| --- a/runtime/vm/os_thread_android.cc
|
| +++ b/runtime/vm/os_thread_android.cc
|
| @@ -4,7 +4,6 @@
|
|
|
| #include "platform/globals.h" // NOLINT
|
|
|
| -
|
| #if defined(HOST_OS_ANDROID)
|
|
|
| #include "vm/os_thread.h"
|
| @@ -29,7 +28,6 @@ namespace dart {
|
| FATAL2("pthread error: %d (%s)", result, error_message); \
|
| }
|
|
|
| -
|
| #if defined(DEBUG)
|
| #define ASSERT_PTHREAD_SUCCESS(result) VALIDATE_PTHREAD_RESULT(result)
|
| #else
|
| @@ -37,7 +35,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 +50,6 @@ namespace dart {
|
| if (result != 0) return result;
|
| #endif
|
|
|
| -
|
| static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) {
|
| struct timeval tv;
|
| int64_t secs = micros / kMicrosecondsPerSecond;
|
| @@ -68,7 +64,6 @@ static void ComputeTimeSpecMicros(struct timespec* ts, int64_t micros) {
|
| }
|
| }
|
|
|
| -
|
| class ThreadStartData {
|
| public:
|
| ThreadStartData(const char* name,
|
| @@ -88,7 +83,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 +97,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 +121,6 @@ static void* ThreadStart(void* data_ptr) {
|
| return NULL;
|
| }
|
|
|
| -
|
| int OSThread::Start(const char* name,
|
| ThreadStartFunction function,
|
| uword parameter) {
|
| @@ -151,12 +143,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 +155,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 gettid();
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
| ThreadId OSThread::GetCurrentThreadTraceId() {
|
| return GetCurrentThreadId();
|
| }
|
| #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 +195,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 a == b;
|
| }
|
|
|
| -
|
| bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) {
|
| pthread_attr_t attr;
|
| if (pthread_getattr_np(pthread_self(), &attr)) {
|
| @@ -253,7 +232,6 @@ bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) {
|
| return true;
|
| }
|
|
|
| -
|
| Mutex::Mutex() {
|
| pthread_mutexattr_t attr;
|
| int result = pthread_mutexattr_init(&attr);
|
| @@ -277,7 +255,6 @@ Mutex::Mutex() {
|
| #endif // defined(DEBUG)
|
| }
|
|
|
| -
|
| Mutex::~Mutex() {
|
| int result = pthread_mutex_destroy(data_.mutex());
|
| // Verify that the pthread_mutex was destroyed.
|
| @@ -289,7 +266,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 +277,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 +291,6 @@ bool Mutex::TryLock() {
|
| return true;
|
| }
|
|
|
| -
|
| void Mutex::Unlock() {
|
| #if defined(DEBUG)
|
| // When running with assertions enabled we do track the owner.
|
| @@ -329,7 +303,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);
|
| @@ -362,7 +335,6 @@ Monitor::Monitor() {
|
| #endif // defined(DEBUG)
|
| }
|
|
|
| -
|
| Monitor::~Monitor() {
|
| #if defined(DEBUG)
|
| // When running with assertions enabled we track the owner.
|
| @@ -376,7 +348,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.
|
| @@ -392,7 +363,6 @@ bool Monitor::TryEnter() {
|
| return true;
|
| }
|
|
|
| -
|
| void Monitor::Enter() {
|
| int result = pthread_mutex_lock(data_.mutex());
|
| VALIDATE_PTHREAD_RESULT(result);
|
| @@ -404,7 +374,6 @@ void Monitor::Enter() {
|
| #endif // defined(DEBUG)
|
| }
|
|
|
| -
|
| void Monitor::Exit() {
|
| #if defined(DEBUG)
|
| // When running with assertions enabled we track the owner.
|
| @@ -416,12 +385,10 @@ void Monitor::Exit() {
|
| VALIDATE_PTHREAD_RESULT(result);
|
| }
|
|
|
| -
|
| Monitor::WaitResult Monitor::Wait(int64_t millis) {
|
| return WaitMicros(millis * kMicrosecondsPerMillisecond);
|
| }
|
|
|
| -
|
| Monitor::WaitResult Monitor::WaitMicros(int64_t micros) {
|
| #if defined(DEBUG)
|
| // When running with assertions enabled we track the owner.
|
| @@ -454,7 +421,6 @@ Monitor::WaitResult Monitor::WaitMicros(int64_t micros) {
|
| return retval;
|
| }
|
|
|
| -
|
| void Monitor::Notify() {
|
| // When running with assertions enabled we track the owner.
|
| ASSERT(IsOwnedByCurrentThread());
|
| @@ -462,7 +428,6 @@ void Monitor::Notify() {
|
| VALIDATE_PTHREAD_RESULT(result);
|
| }
|
|
|
| -
|
| void Monitor::NotifyAll() {
|
| // When running with assertions enabled we track the owner.
|
| ASSERT(IsOwnedByCurrentThread());
|
|
|