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

Unified Diff: runtime/vm/thread.cc

Issue 1037453002: Split Thread/Isolate instances, but still maintain 1:1 relationship. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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
Index: runtime/vm/thread.cc
===================================================================
--- runtime/vm/thread.cc (revision 0)
+++ runtime/vm/thread.cc (working copy)
@@ -0,0 +1,30 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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 "vm/thread.h"
+
+#include "vm/isolate.h"
+#include "vm/os_thread.h"
+
+
+namespace dart {
+
+// The single thread local key which stores all the thread local data
+// for a thread.
+// TODO(koda): Can we merge this with ThreadInterrupter::thread_state_key_?
+ThreadLocalKey Thread::thread_key = OSThread::kUnsetThreadLocalKey;
+
+
+void Thread::InitOnce() {
+ ASSERT(thread_key == OSThread::kUnsetThreadLocalKey);
+ thread_key = OSThread::CreateThreadLocal();
+ ASSERT(thread_key != OSThread::kUnsetThreadLocalKey);
+}
+
+
+void Thread::SetCurrent(Thread* current) {
+ OSThread::SetThreadLocal(thread_key, reinterpret_cast<uword>(current));
+}
+
+} // namespace dart
« runtime/vm/thread.h ('K') | « runtime/vm/thread.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698