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

Side by Side Diff: third_party/WebKit/Source/wtf/Threading.h

Issue 2386843002: reflow comments in wtf (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 */ 28 */
29 29
30 #ifndef Threading_h 30 #ifndef Threading_h
31 #define Threading_h 31 #define Threading_h
32 32
33 #include "wtf/Atomics.h" 33 #include "wtf/Atomics.h"
34 #include "wtf/TypeTraits.h" 34 #include "wtf/TypeTraits.h"
35 #include "wtf/WTFExport.h" 35 #include "wtf/WTFExport.h"
36 #include <stdint.h> 36 #include <stdint.h>
37 37
38 // For portability, we do not make use of C++11 thread-safe statics, as supporte d 38 // For portability, we do not make use of C++11 thread-safe statics, as
39 // by some toolchains. Make use of double-checked locking to reduce overhead. 39 // supported by some toolchains. Make use of double-checked locking to reduce
40 // Note that this uses system-wide default lock, and cannot be used before 40 // overhead. Note that this uses system-wide default lock, and cannot be used
41 // 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 /* Init to nullptr is thread-safe on all implementations. */ \ 43 /* Init to nullptr is thread-safe on all implementations. */ \
44 static void* name##Pointer = nullptr; \ 44 static void* name##Pointer = nullptr; \
45 if (!WTF::acquireLoad(&name##Pointer)) { \ 45 if (!WTF::acquireLoad(&name##Pointer)) { \
46 WTF::lockAtomicallyInitializedStaticMutex(); \ 46 WTF::lockAtomicallyInitializedStaticMutex(); \
47 if (!WTF::acquireLoad(&name##Pointer)) { \ 47 if (!WTF::acquireLoad(&name##Pointer)) { \
48 std::remove_const<T>::type* initializerResult = initializer; \ 48 std::remove_const<T>::type* initializerResult = initializer; \
49 WTF::releaseStore(&name##Pointer, initializerResult); \ 49 WTF::releaseStore(&name##Pointer, initializerResult); \
50 } \ 50 } \
51 WTF::unlockAtomicallyInitializedStaticMutex(); \ 51 WTF::unlockAtomicallyInitializedStaticMutex(); \
(...skipping 18 matching lines...) Expand all
70 WTF_EXPORT bool isBeforeThreadCreated(); 70 WTF_EXPORT bool isBeforeThreadCreated();
71 WTF_EXPORT void willCreateThread(); 71 WTF_EXPORT void willCreateThread();
72 #endif 72 #endif
73 73
74 } // namespace WTF 74 } // namespace WTF
75 75
76 using WTF::ThreadIdentifier; 76 using WTF::ThreadIdentifier;
77 using WTF::currentThread; 77 using WTF::currentThread;
78 78
79 #endif // Threading_h 79 #endif // Threading_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/ThreadSpecificWin.cpp ('k') | third_party/WebKit/Source/wtf/ThreadingPrimitives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698