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

Unified Diff: runtime/vm/os_thread_linux.cc

Issue 796063006: Rename Thread -> OSThread. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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/vm/os_thread_linux.h ('k') | runtime/vm/os_thread_macos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « runtime/vm/os_thread_linux.h ('k') | runtime/vm/os_thread_macos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698