Chromium Code Reviews| Index: Source/wtf/ThreadingPthreads.cpp |
| diff --git a/Source/wtf/ThreadingPthreads.cpp b/Source/wtf/ThreadingPthreads.cpp |
| index 2208ca4e9a863411ba69a3ee9b52c6c221a96ceb..91e7ef7889c6be5f20872e0de420234a3927543d 100644 |
| --- a/Source/wtf/ThreadingPthreads.cpp |
| +++ b/Source/wtf/ThreadingPthreads.cpp |
| @@ -246,6 +246,33 @@ void ThreadCondition::broadcast() |
| ASSERT_UNUSED(result, !result); |
| } |
| +#if ENABLE(ASSERT) |
| +static bool s_threadCreated = false; |
| + |
| +struct ThreadCreationRecorder { |
| + ThreadCreationRecorder() |
| + { |
| + ASSERT(!s_threadCreated); |
|
eroman
2015/01/30 18:02:30
Not sure how valuable this assertion is. Probably
kinuko
2015/02/03 06:57:34
Done.
|
| + s_threadCreated = true; |
| + } |
| +}; |
| + |
| +bool isAtomicallyInitializedStaticMutexLockHeld() |
| +{ |
| + return atomicallyInitializedStaticMutex && atomicallyInitializedStaticMutex->locked(); |
| +} |
| + |
| +bool isBeforeThreadCreated() |
| +{ |
| + return !s_threadCreated; |
| +} |
| + |
| +void willCreateThread() |
| +{ |
| + static ThreadCreationRecorder recorder; |
| +} |
| +#endif |
| + |
| } // namespace WTF |
| #endif // USE(PTHREADS) |