| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #ifndef Threading_h | 30 #ifndef Threading_h |
| 31 #define Threading_h | 31 #define Threading_h |
| 32 | 32 |
| 33 #include <stdint.h> |
| 33 #include "wtf/Atomics.h" | 34 #include "wtf/Atomics.h" |
| 34 #include "wtf/TypeTraits.h" | 35 #include "wtf/TypeTraits.h" |
| 35 #include "wtf/WTFExport.h" | 36 #include "wtf/WTFExport.h" |
| 36 #include <stdint.h> | |
| 37 | 37 |
| 38 // For portability, we do not make use of C++11 thread-safe statics, as | 38 // For portability, we do not make use of C++11 thread-safe statics, as |
| 39 // supported by some toolchains. Make use of double-checked locking to reduce | 39 // supported by some toolchains. Make use of double-checked locking to reduce |
| 40 // overhead. Note that this uses system-wide default lock, and cannot be used | 40 // overhead. Note that this uses system-wide default lock, and cannot be used |
| 41 // before WTF::initializeThreading() is called. | 41 // before WTF::initializeThreading() is called. |
| 42 #define DEFINE_THREAD_SAFE_STATIC_LOCAL(T, name, initializer) \ | 42 #define DEFINE_THREAD_SAFE_STATIC_LOCAL(T, name, initializer) \ |
| 43 static_assert(!WTF::IsGarbageCollectedType<T>::value, \ | 43 static_assert(!WTF::IsGarbageCollectedType<T>::value, \ |
| 44 "Garbage collected types should not be a static local!"); \ | 44 "Garbage collected types should not be a static local!"); \ |
| 45 /* Init to nullptr is thread-safe on all implementations. */ \ | 45 /* Init to nullptr is thread-safe on all implementations. */ \ |
| 46 static void* name##Pointer = nullptr; \ | 46 static void* name##Pointer = nullptr; \ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 76 WTF_EXPORT bool isBeforeThreadCreated(); | 76 WTF_EXPORT bool isBeforeThreadCreated(); |
| 77 WTF_EXPORT void willCreateThread(); | 77 WTF_EXPORT void willCreateThread(); |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 } // namespace WTF | 80 } // namespace WTF |
| 81 | 81 |
| 82 using WTF::ThreadIdentifier; | 82 using WTF::ThreadIdentifier; |
| 83 using WTF::currentThread; | 83 using WTF::currentThread; |
| 84 | 84 |
| 85 #endif // Threading_h | 85 #endif // Threading_h |
| OLD | NEW |