Index: runtime/vm/os_thread_linux.cc |
=================================================================== |
--- runtime/vm/os_thread_linux.cc (revision 42873) |
+++ runtime/vm/os_thread_linux.cc (working copy) |
@@ -2,10 +2,10 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-#include "platform/globals.h" |
+#include "platform/globals.h" // NOLINT |
#if defined(TARGET_OS_LINUX) |
-#include "vm/thread.h" |
+#include "vm/os_thread.h" |
#include <errno.h> // NOLINT |
#include <sys/resource.h> // NOLINT |
@@ -58,15 +58,15 @@ |
class ThreadStartData { |
public: |
- ThreadStartData(Thread::ThreadStartFunction function, |
+ ThreadStartData(OSThread::ThreadStartFunction function, |
uword parameter) |
: function_(function), parameter_(parameter) {} |
- Thread::ThreadStartFunction function() const { return function_; } |
+ OSThread::ThreadStartFunction function() const { return function_; } |
uword parameter() const { return parameter_; } |
private: |
- Thread::ThreadStartFunction function_; |
+ OSThread::ThreadStartFunction function_; |
uword parameter_; |
DISALLOW_COPY_AND_ASSIGN(ThreadStartData); |
@@ -79,7 +79,7 @@ |
static void* ThreadStart(void* data_ptr) { |
ThreadStartData* data = reinterpret_cast<ThreadStartData*>(data_ptr); |
- Thread::ThreadStartFunction function = data->function(); |
+ OSThread::ThreadStartFunction function = data->function(); |
uword parameter = data->parameter(); |
delete data; |
@@ -90,7 +90,7 @@ |
} |
-int Thread::Start(ThreadStartFunction function, uword parameter) { |
+int OSThread::Start(ThreadStartFunction function, uword parameter) { |
pthread_attr_t attr; |
int result = pthread_attr_init(&attr); |
RETURN_ON_PTHREAD_FAILURE(result); |
@@ -98,7 +98,7 @@ |
result = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
RETURN_ON_PTHREAD_FAILURE(result); |
- result = pthread_attr_setstacksize(&attr, Thread::GetMaxStackSize()); |
+ result = pthread_attr_setstacksize(&attr, OSThread::GetMaxStackSize()); |
RETURN_ON_PTHREAD_FAILURE(result); |
ThreadStartData* data = new ThreadStartData(function, parameter); |
@@ -114,10 +114,11 @@ |
} |
-ThreadLocalKey Thread::kUnsetThreadLocalKey = static_cast<pthread_key_t>(-1); |
-ThreadId Thread::kInvalidThreadId = static_cast<ThreadId>(0); |
+ThreadLocalKey OSThread::kUnsetThreadLocalKey = |
+ static_cast<pthread_key_t>(-1); |
+ThreadId OSThread::kInvalidThreadId = static_cast<ThreadId>(0); |
-ThreadLocalKey Thread::CreateThreadLocal() { |
+ThreadLocalKey OSThread::CreateThreadLocal() { |
pthread_key_t key = kUnsetThreadLocalKey; |
int result = pthread_key_create(&key, NULL); |
VALIDATE_PTHREAD_RESULT(result); |
@@ -126,7 +127,7 @@ |
} |
-void Thread::DeleteThreadLocal(ThreadLocalKey key) { |
+void OSThread::DeleteThreadLocal(ThreadLocalKey key) { |
ASSERT(key != kUnsetThreadLocalKey); |
int result = pthread_key_delete(key); |
VALIDATE_PTHREAD_RESULT(result); |
@@ -133,7 +134,7 @@ |
} |
-void Thread::SetThreadLocal(ThreadLocalKey key, uword value) { |
+void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) { |
ASSERT(key != kUnsetThreadLocalKey); |
int result = pthread_setspecific(key, reinterpret_cast<void*>(value)); |
VALIDATE_PTHREAD_RESULT(result); |
@@ -140,34 +141,34 @@ |
} |
-intptr_t Thread::GetMaxStackSize() { |
+intptr_t OSThread::GetMaxStackSize() { |
const int kStackSize = (128 * kWordSize * KB); |
return kStackSize; |
} |
-ThreadId Thread::GetCurrentThreadId() { |
+ThreadId OSThread::GetCurrentThreadId() { |
return pthread_self(); |
} |
-bool Thread::Join(ThreadId id) { |
+bool OSThread::Join(ThreadId id) { |
return false; |
} |
-intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { |
+intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { |
ASSERT(sizeof(id) == sizeof(intptr_t)); |
return static_cast<intptr_t>(id); |
} |
-bool Thread::Compare(ThreadId a, ThreadId b) { |
+bool OSThread::Compare(ThreadId a, ThreadId b) { |
return pthread_equal(a, b) != 0; |
} |
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { |
+void OSThread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) { |
ASSERT(thread_id == GetCurrentThreadId()); |
ASSERT(cpu_usage != NULL); |
struct timespec ts; |