| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void threadWasJoined(ThreadIdentifier); | 105 void threadWasJoined(ThreadIdentifier); |
| 106 | 106 |
| 107 static Mutex& threadMapMutex() | 107 static Mutex& threadMapMutex() |
| 108 { | 108 { |
| 109 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); | 109 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); |
| 110 return mutex; | 110 return mutex; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void initializeThreading() | 113 void initializeThreading() |
| 114 { | 114 { |
| 115 if (atomicallyInitializedStaticMutex) | 115 // This should only be called once. |
| 116 return; | 116 ASSERT(!atomicallyInitializedStaticMutex); |
| 117 | 117 |
| 118 WTF::double_conversion::initialize(); | 118 WTF::double_conversion::initialize(); |
| 119 // StringImpl::empty() does not construct its static string in a threadsafe
fashion, | 119 // StringImpl::empty() does not construct its static string in a threadsafe
fashion, |
| 120 // so ensure it has been initialized from here. | 120 // so ensure it has been initialized from here. |
| 121 StringImpl::empty(); | 121 StringImpl::empty(); |
| 122 atomicallyInitializedStaticMutex = new Mutex; | 122 atomicallyInitializedStaticMutex = new Mutex; |
| 123 threadMapMutex(); | 123 threadMapMutex(); |
| 124 initializeRandomNumberGenerator(); | 124 initializeRandomNumberGenerator(); |
| 125 ThreadIdentifierData::initializeOnce(); | 125 ThreadIdentifierData::initializeOnce(); |
| 126 StackStats::initialize(); | 126 StackStats::initialize(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 void ThreadCondition::broadcast() | 387 void ThreadCondition::broadcast() |
| 388 { | 388 { |
| 389 int result = pthread_cond_broadcast(&m_condition); | 389 int result = pthread_cond_broadcast(&m_condition); |
| 390 ASSERT_UNUSED(result, !result); | 390 ASSERT_UNUSED(result, !result); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace WTF | 393 } // namespace WTF |
| 394 | 394 |
| 395 #endif // USE(PTHREADS) | 395 #endif // USE(PTHREADS) |
| OLD | NEW |