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

Unified Diff: runtime/vm/thread_pool.cc

Issue 1439483003: - Add an OSThread structure which is the generic TLS structure for all C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review Created 5 years, 1 month 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/thread_interrupter_win.cc ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_pool.cc
diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc
index d5472a661001541f0d95bb3d2474b173ef3e7d0d..86d2f609db871a78995d25f75e8118c1e8c53a0b 100644
--- a/runtime/vm/thread_pool.cc
+++ b/runtime/vm/thread_pool.cc
@@ -101,7 +101,9 @@ void ThreadPool::Shutdown() {
// First tell all the workers to shut down.
Worker* current = saved;
- ThreadId id = OSThread::GetCurrentThreadId();
+ OSThread* os_thread = OSThread::Current();
+ ASSERT(os_thread != NULL);
+ ThreadId id = os_thread->id();
while (current != NULL) {
Worker* next = current->all_next_;
ThreadId currentId = current->id();
@@ -245,7 +247,9 @@ bool ThreadPool::ReleaseIdleWorker(Worker* worker) {
// The thread for worker will exit. Add its ThreadId to the join_list_
// so that we can join on it at the next opportunity.
- JoinList::AddLocked(OSThread::GetCurrentThreadJoinId(), &join_list_);
+ OSThread* os_thread = OSThread::Current();
+ ASSERT(os_thread != NULL);
+ JoinList::AddLocked(os_thread->join_id(), &join_list_);
count_stopped_++;
count_idle_--;
return true;
@@ -333,7 +337,9 @@ void ThreadPool::Worker::StartThread() {
ASSERT(task_ != NULL);
}
#endif
- int result = OSThread::Start(&Worker::Main, reinterpret_cast<uword>(this));
+ int result = OSThread::Start("Dart ThreadPool Worker",
+ &Worker::Main,
+ reinterpret_cast<uword>(this));
if (result != 0) {
FATAL1("Could not start worker thread: result = %d.", result);
}
@@ -417,12 +423,11 @@ void ThreadPool::Worker::Shutdown() {
// static
void ThreadPool::Worker::Main(uword args) {
- Thread::EnsureInit();
- Thread* thread = Thread::Current();
- thread->set_name("Dart ThreadPool Worker");
Worker* worker = reinterpret_cast<Worker*>(args);
- ThreadId id = OSThread::GetCurrentThreadId();
- ThreadJoinId join_id = OSThread::GetCurrentThreadJoinId();
+ OSThread* os_thread = OSThread::Current();
+ ASSERT(os_thread != NULL);
+ ThreadId id = os_thread->id();
+ ThreadJoinId join_id = os_thread->join_id();
ThreadPool* pool;
{
« no previous file with comments | « runtime/vm/thread_interrupter_win.cc ('k') | runtime/vm/thread_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698