OLD | NEW |
1 /* | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 // Use of this source code is governed by a BSD-style license that can be |
3 * Copyright (C) 2007 Justin Haygood (jhaygood@reaktix.com) | 3 // found in the LICENSE file. |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * | |
9 * 1. Redistributions of source code must retain the above copyright | |
10 * notice, this list of conditions and the following disclaimer. | |
11 * 2. Redistributions in binary form must reproduce the above copyright | |
12 * notice, this list of conditions and the following disclaimer in the | |
13 * documentation and/or other materials provided with the distribution. | |
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
15 * its contributors may be used to endorse or promote products derived | |
16 * from this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
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 | |
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 | |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 */ | |
29 | 4 |
30 #ifndef Threading_h | 5 #include "platform/wtf/Threading.h" |
31 #define Threading_h | |
32 | 6 |
33 #include "wtf/Atomics.h" | 7 // The contents of this header was moved to platform/wtf as part of |
34 #include "wtf/TypeTraits.h" | 8 // WTF migration project. See the following post for details: |
35 #include "wtf/WTFExport.h" | 9 // https://groups.google.com/a/chromium.org/d/msg/blink-dev/tLdAZCTlcAA/bYXVT8gY
CAAJ |
36 #include <stdint.h> | |
37 | |
38 namespace WTF { | |
39 | |
40 #if OS(WIN) | |
41 typedef uint32_t ThreadIdentifier; | |
42 #else | |
43 typedef intptr_t ThreadIdentifier; | |
44 #endif | |
45 | |
46 namespace internal { | |
47 WTF_EXPORT ThreadIdentifier currentThreadSyscall(); | |
48 } // namespace internal | |
49 | |
50 // Initializes global state required by |currentThread|. | |
51 // Needs to be called once during program execution, before |currentThread|. | |
52 WTF_EXPORT void initializeCurrentThread(); | |
53 | |
54 WTF_EXPORT ThreadIdentifier currentThread(); | |
55 | |
56 #if DCHECK_IS_ON() | |
57 WTF_EXPORT bool isBeforeThreadCreated(); | |
58 WTF_EXPORT void willCreateThread(); | |
59 #endif | |
60 | |
61 } // namespace WTF | |
62 | |
63 using WTF::ThreadIdentifier; | |
64 using WTF::currentThread; | |
65 | |
66 #endif // Threading_h | |
OLD | NEW |