Files
sdk/runtime/vm/thread.cc
T
koda@google.com 642ff6ebb4 volatile -> const, where possible
These 'volatile' modifiers were added to silence warnings about setjmp/longjmp clobbering, but 'const' works too and allows more optimization.

TBR=iposva@google.com

Review URL: https://codereview.chromium.org//1037333002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44749 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-27 18:11:51 +00:00

31 lines
878 B
C++

// 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