Reviewers: jarin,
Description:
Access thread instance in posix platform using NoBarrier_Load and
NoBarrier_Store.
BUG=
Please review this at https://codereview.chromium.org/195863003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+8, -3 lines):
M src/platform-posix.cc
Index: src/platform-posix.cc
diff --git a/src/platform-posix.cc b/src/platform-posix.cc
index
94aabe8d581101fc08ffb95298de55cf3625c89d..42749e75e9e2e1d433a0c7530e4867fd0b124e1e
100644
--- a/src/platform-posix.cc
+++ b/src/platform-posix.cc
@@ -615,9 +615,12 @@ static void* ThreadEntry(void* arg) {
// This is also initialized by the first argument to pthread_create()
but we
// don't know which thread will run first (the original thread or the new
// one) so we initialize it here too.
- thread->data()->thread_ = pthread_self();
+ NoBarrier_Store(reinterpret_cast<AtomicWord*>(&thread->data()->thread_),
+ pthread_self());
SetThreadName(thread->name());
- ASSERT(thread->data()->thread_ != kNoThread);
+ ASSERT(static_cast<pthread_t>(
+ NoBarrier_Load(reinterpret_cast<AtomicWord*>(
+ &thread->data()->thread_))) != kNoThread);
thread->NotifyStartedAndRun();
return NULL;
}
@@ -646,7 +649,9 @@ void Thread::Start() {
ASSERT_EQ(0, result);
result = pthread_attr_destroy(&attr);
ASSERT_EQ(0, result);
- ASSERT(data_->thread_ != kNoThread);
+ ASSERT(static_cast<pthread_t>(
+ NoBarrier_Load(reinterpret_cast<AtomicWord*>(
+ &data_->thread_))) != kNoThread);
USE(result);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.