facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.04k stars 536 forks source link

Patch for fixing setThreadName #98

Closed michaelaeriksen closed 6 years ago

michaelaeriksen commented 7 years ago

From 9aecf3a4df921ff6a996dcdcb1493b7763989a92 Mon Sep 17 00:00:00 2001 From: "Michael A. Eriksen" michael@abundantrobotics.com Date: Thu, 8 Jun 2017 15:39:25 -0700 Subject: [PATCH] fix for setting std::thread name


wangle/concurrent/NamedThreadFactory.h | 6 ++++++ 1 file changed, 6 insertions(+)

diff --git a/wangle/concurrent/NamedThreadFactory.h b/wangle/concurrent/NamedThreadFactory.h index b3f7f8b..f3d2fc2 100644 --- a/wangle/concurrent/NamedThreadFactory.h +++ b/wangle/concurrent/NamedThreadFactory.h @@ -28,9 +28,15 @@ class NamedThreadFactory : public ThreadFactory {

std::thread newThread(folly::Func&& func) override { auto thread = std::thread(std::move(func)); +#if FOLLY_HAVE_PTHREAD folly::setThreadName( thread.nativehandle(), folly::to(prefix, suffix_++)); +#else

-- 2.13.0.windows.1

yfeldblum commented 6 years ago

Too old. Please reopen as a PR if this is still an issue.