Commit fa173c4e authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

outline HashingThreadId::get

Reviewed By: Mizuchi

Differential Revision: D27669414

fbshipit-source-id: 617e0b5f17fa8ce5505f7f16b00516ba7f21b064
parent e370385a
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <folly/Exception.h> #include <folly/Exception.h>
#include <folly/FileUtil.h> #include <folly/FileUtil.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/hash/Hash.h>
#include <folly/system/ThreadId.h>
namespace folly { namespace folly {
...@@ -327,6 +329,11 @@ unsigned SequentialThreadId::get() { ...@@ -327,6 +329,11 @@ unsigned SequentialThreadId::get() {
} }
#endif #endif
/////////////// HashingThreadId
unsigned HashingThreadId::get() {
return hash::twang_32from64(getCurrentThreadID());
}
namespace detail { namespace detail {
int AccessSpreaderBase::degenerateGetcpu(unsigned* cpu, unsigned* node, void*) { int AccessSpreaderBase::degenerateGetcpu(unsigned* cpu, unsigned* node, void*) {
......
...@@ -32,10 +32,8 @@ ...@@ -32,10 +32,8 @@
#include <folly/Likely.h> #include <folly/Likely.h>
#include <folly/Memory.h> #include <folly/Memory.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/hash/Hash.h>
#include <folly/lang/Align.h> #include <folly/lang/Align.h>
#include <folly/lang/Exception.h> #include <folly/lang/Exception.h>
#include <folly/system/ThreadId.h>
#if !FOLLY_MOBILE && defined(FOLLY_TLS) #if !FOLLY_MOBILE && defined(FOLLY_TLS)
#define FOLLY_CL_USE_FOLLY_TLS 1 #define FOLLY_CL_USE_FOLLY_TLS 1
...@@ -154,7 +152,7 @@ struct SequentialThreadId { ...@@ -154,7 +152,7 @@ struct SequentialThreadId {
#endif #endif
struct HashingThreadId { struct HashingThreadId {
static unsigned get() { return hash::twang_32from64(getCurrentThreadID()); } static unsigned get();
}; };
/// A class that lazily binds a unique (for each implementation of Atom) /// A class that lazily binds a unique (for each implementation of Atom)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment