projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make folly pass TSAN checks
[folly.git]
/
folly
/
ThreadId.h
diff --git
a/folly/ThreadId.h
b/folly/ThreadId.h
index 104a53e04e493f3675b857a742862090b268d84b..6593b3f101efec722487deef6fb448be3f523c9b 100644
(file)
--- a/
folly/ThreadId.h
+++ b/
folly/ThreadId.h
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 201
6
Facebook, Inc.
+ * Copyright 201
7
Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-18,15
+18,16
@@
#include <cstdint>
#include <cstdint>
-#include <pthread.h>
+#include <folly/portability/PThread.h>
+#include <folly/portability/Windows.h>
namespace folly {
inline uint64_t getCurrentThreadID() {
namespace folly {
inline uint64_t getCurrentThreadID() {
-#if
def _WIN32
- // There's no need to force a Windows.h include, so grab the ID
- // via pthread instead.
- return uint64_t(
pthread_getw32threadid_np(pthread_self()
));
+#if
__APPLE__
+ return uint64_t(pthread_mach_thread_np(pthread_self()));
+#elif _WIN32
+ return uint64_t(
GetCurrentThreadId(
));
#else
return uint64_t(pthread_self());
#endif
#else
return uint64_t(pthread_self());
#endif