proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
ThreadId.h
Go to the documentation of this file.
1
/*
2
* Copyright 2016-present Facebook, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <cstdint>
20
21
#include <
folly/portability/PThread.h
>
22
#include <
folly/portability/SysSyscall.h
>
23
#include <
folly/portability/Unistd.h
>
24
#include <
folly/portability/Windows.h
>
25
26
namespace
folly
{
27
42
inline
uint64_t
getCurrentThreadID
() {
43
#if __APPLE__
44
return
uint64_t
(pthread_mach_thread_np(pthread_self()));
45
#elif _WIN32
46
return
uint64_t
(GetCurrentThreadId());
47
#else
48
return
uint64_t
(pthread_self());
49
#endif
50
}
51
80
inline
uint64_t
getOSThreadID
() {
81
#if __APPLE__
82
uint64_t
tid;
83
pthread_threadid_np(
nullptr
, &tid);
84
return
tid;
85
#elif _WIN32
86
return
uint64_t
(GetCurrentThreadId());
87
#else
88
return
uint64_t
(syscall(
FOLLY_SYS_gettid
));
89
#endif
90
}
91
}
// namespace folly
folly
—— Concurrent Priority Queue Implementation ——
Definition:
AtomicBitSet.h:29
folly::getOSThreadID
uint64_t getOSThreadID()
Definition:
ThreadId.h:80
SysSyscall.h
PThread.h
FOLLY_SYS_gettid
#define FOLLY_SYS_gettid
Definition:
SysSyscall.h:27
Unistd.h
Windows.h
folly::getCurrentThreadID
uint64_t getCurrentThreadID()
Definition:
ThreadId.h:42
uint64_t
uint64_t
Definition:
ConstexprMathBenchmark.cpp:190
proxygen
folly
folly
system
ThreadId.h
Generated by
1.8.11