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

Unified Diff: Source/heap/ThreadState.cpp

Issue 199413012: Introduce WTF::releaseStore and WTF::acquireLoad. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address glider's comments Created 6 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
« no previous file with comments | « no previous file | Source/wtf/Atomics.h » ('j') | Source/wtf/Atomics.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/heap/ThreadState.cpp
diff --git a/Source/heap/ThreadState.cpp b/Source/heap/ThreadState.cpp
index 8e99f28c085202cb03d8a4ddd6237a45c04c8ab0..fbabf2c7aecdbf4acc20bc184a00a5e7d74d6bb9 100644
--- a/Source/heap/ThreadState.cpp
+++ b/Source/heap/ThreadState.cpp
@@ -115,7 +115,7 @@ public:
MutexLocker locker(m_mutex);
atomicAdd(&m_unparkedThreadCount, threads.size());
- atomicSetOneToZero(&m_canResume);
+ releaseStore(&m_canResume, 0);
ThreadState* current = ThreadState::current();
for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end = threads.end(); it != end; ++it) {
@@ -127,7 +127,7 @@ public:
interruptors[i]->requestInterrupt();
}
- while (m_unparkedThreadCount > 0)
+ while (acquireLoad(&m_unparkedThreadCount) > 0)
m_parked.wait(m_mutex);
}
@@ -135,7 +135,7 @@ public:
{
ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads();
atomicSubtract(&m_unparkedThreadCount, threads.size());
- atomicTestAndSetToOne(&m_canResume);
+ releaseStore(&m_canResume, 1);
{
// FIXME: Resumed threads will all contend for
// m_mutex just to unlock it later which is a waste of
@@ -164,7 +164,7 @@ public:
MutexLocker locker(m_mutex);
if (!atomicDecrement(&m_unparkedThreadCount))
m_parked.signal();
- while (!m_canResume)
+ while (!acquireLoad(&m_canResume))
m_resume.wait(m_mutex);
atomicIncrement(&m_unparkedThreadCount);
}
@@ -172,7 +172,7 @@ public:
void checkAndPark(ThreadState* state)
{
ASSERT(!state->isSweepInProgress());
- if (!m_canResume) {
+ if (!acquireLoad(&m_canResume)) {
pushAllRegisters(this, state, parkAfterPushRegisters);
state->performPendingSweep();
}
« no previous file with comments | « no previous file | Source/wtf/Atomics.h » ('j') | Source/wtf/Atomics.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698