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

Unified Diff: third_party/WebKit/Source/platform/heap/SafePoint.h

Issue 2039793002: Add documentation of SafePointBarrier internal state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | third_party/WebKit/Source/platform/heap/SafePoint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/SafePoint.h
diff --git a/third_party/WebKit/Source/platform/heap/SafePoint.h b/third_party/WebKit/Source/platform/heap/SafePoint.h
index 4e3c8f45377b52bc8e28b183486132f72ba49553..9353c6dcf6e515d28bd9be6a2b669535408f8b84 100644
--- a/third_party/WebKit/Source/platform/heap/SafePoint.h
+++ b/third_party/WebKit/Source/platform/heap/SafePoint.h
@@ -123,9 +123,34 @@ private:
barrier->doEnterSafePoint(state, stackEnd);
}
- volatile int m_canResume;
+ // |m_unparkedThreadCount| tracks amount of unparked threads. It is
+ // positive if and only if a thread has requested the other threads
+ // to park themselves at safe-points in preparation for a GC.
+ //
+ // The last thread to park itself will make the counter hit zero
+ // and should notify GC-requesting thread that it is safe to proceed.
+ //
+ // If no other thread is waiting for other threads to park then
+ // this counter can be negative: if N threads are at safe-points
+ // the counter will be -N.
volatile int m_unparkedThreadCount;
+
+ // |m_parkingRequested| is used to control the transition of threads parked
+ // at a safepoint back to running state. In the event a thread requests
+ // another GC, threads that have yet to leave their safepoint (due to lock
+ // contention, scheduling etc), shouldn't be allowed to leave, but continue
+ // being parked when they do end up getting to run.
+ //
+ // |m_parkingRequested| is set when parkOthers() runs, and cleared by
+ // resumeOthers(), when the global GC steps have completed.
+ //
+ // Threads that were parked after they were requested to and then signalled,
+ // check that no other thread has made another parking request when attempting
+ // to resume in doPark().
+ volatile int m_parkingRequested;
+
Mutex m_mutex;
+
ThreadCondition m_parked;
ThreadCondition m_resume;
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/SafePoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698