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

Unified Diff: runtime/vm/isolate.cc

Issue 9328042: Move the thread local functions to the Thread class in runtime/platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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/isolate.h ('k') | runtime/vm/isolate_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index e2c77fa0066167c8263fda45688a222fc1a48953..e5c73b4ee887f51e785b10fbe81f652439ded9ee 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -134,6 +134,25 @@ Isolate::~Isolate() {
message_handler_ = NULL; // Fail fast if we send messages to a dead isolate.
}
+void Isolate::SetCurrent(Isolate* current) {
+ Thread::SetThreadLocal(isolate_key, reinterpret_cast<uword>(current));
+}
+
+
+// The single thread local key which stores all the thread local data
+// for a thread. Since an Isolate is the central repository for
+// storing all isolate specific information a single thread local key
+// is sufficient.
+ThreadLocalKey Isolate::isolate_key = Thread::kUnsetThreadLocalKey;
+
+
+void Isolate::InitOnce() {
+ ASSERT(isolate_key == Thread::kUnsetThreadLocalKey);
+ isolate_key = Thread::CreateThreadLocal();
+ ASSERT(isolate_key != Thread::kUnsetThreadLocalKey);
+ create_callback_ = NULL;
+}
+
Isolate* Isolate::Init(const char* name_prefix) {
Isolate* result = new Isolate();
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/isolate_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698