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

Unified Diff: Source/wtf/ThreadingWin.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/ThreadingWin.cpp
diff --git a/Source/wtf/ThreadingWin.cpp b/Source/wtf/ThreadingWin.cpp
index cc342571014f09a02c1ea9d3a519d4a42200e44c..686b51e272b4a34c3717deddd349edc68fc76fc7 100644
--- a/Source/wtf/ThreadingWin.cpp
+++ b/Source/wtf/ThreadingWin.cpp
@@ -391,6 +391,25 @@ DWORD absoluteTimeToWaitTimeoutInterval(double absoluteTime)
return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0);
}
+#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 // OS(WIN)
« Source/platform/WebThreadSupportingGC.cpp ('K') | « Source/wtf/ThreadingPthreads.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698