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

Unified Diff: Source/wtf/ThreadingPthreads.cpp

Issue 874203002: Add a thread-safety assertion in DEFINE_STATIC_LOCAL (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: added noncopyable Created 5 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
Index: Source/wtf/ThreadingPthreads.cpp
diff --git a/Source/wtf/ThreadingPthreads.cpp b/Source/wtf/ThreadingPthreads.cpp
index 2208ca4e9a863411ba69a3ee9b52c6c221a96ceb..42091057fd34e47a65a4a6f406700eeb34c311eb 100644
--- a/Source/wtf/ThreadingPthreads.cpp
+++ b/Source/wtf/ThreadingPthreads.cpp
@@ -246,6 +246,25 @@ void ThreadCondition::broadcast()
ASSERT_UNUSED(result, !result);
}
+#if ENABLE(ASSERT)
+static bool s_threadCreated = false;
+
+bool isAtomicallyInitializedStaticMutexLockHeld()
+{
+ return atomicallyInitializedStaticMutex && atomicallyInitializedStaticMutex->locked();
+}
+
+bool isBeforeThreadCreated()
+{
+ return !s_threadCreated;
+}
+
+void willCreateThread()
+{
+ s_threadCreated = true;
+}
+#endif
+
} // namespace WTF
#endif // USE(PTHREADS)

Powered by Google App Engine
This is Rietveld 408576698