From d23f5206cf72ca3fb53ac3049649bb7d018232bf Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 30 Mar 2012 19:50:04 -0700 Subject: Another crack at implementing a usable GetTid() for Mac OS 10.5... Change-Id: Ic607bc99fa665e81bbbaea1ea0bd1b35f26196ba --- src/utils.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils.cc b/src/utils.cc index 9a12b93d18..3751727780 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -57,7 +57,9 @@ pid_t GetTid() { return syscall(SYS_thread_selfid); #elif defined(__APPLE__) // On Mac OS 10.5 (which the build servers are still running) there was nothing usable. - return getpid(); + // We know we build 32-bit binaries and that the pthread_t is a pointer that uniquely identifies + // the calling thread. + return reinterpret_cast(pthread_self()); #else // Neither bionic nor glibc exposes gettid(2). return syscall(__NR_gettid); -- cgit v1.2.3-59-g8ed1b