From 98439158db96e682467f87b0d6533896db9ae72a Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Tue, 21 Aug 2007 02:39:40 +0000 Subject: [PATCH] Fix thread_t cast again Summary: reinterpret_cast actually breaks on linux, despite working on FreeBSD Reviewed By: dreiss Test Plan: Compile on Linux OR FreeBSD git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665211 13f79535-47bb-0310-9956-ffa450edef68 --- lib/cpp/src/concurrency/PosixThreadFactory.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cpp b/lib/cpp/src/concurrency/PosixThreadFactory.cpp index f6ab6c72..3f356811 100644 --- a/lib/cpp/src/concurrency/PosixThreadFactory.cpp +++ b/lib/cpp/src/concurrency/PosixThreadFactory.cpp @@ -135,7 +135,8 @@ class PthreadThread: public Thread { } id_t getId() { - return reinterpret_cast(pthread_); + // TODO(dreiss): Stop using C-style casts. + return (id_t)pthread_; } shared_ptr runnable() const { return Thread::runnable(); } @@ -258,7 +259,10 @@ class PosixThreadFactory::Impl { void setDetached(bool value) { detached_ = value; } - Thread::id_t getCurrentThreadId() const {return reinterpret_cast(pthread_self());} + Thread::id_t getCurrentThreadId() const { + // TODO(dreiss): Stop using C-style casts. + return (id_t)pthread_self(); + } }; -- 2.17.1