Skip to content

Commit

Permalink
Fix GetTID() on FreeBSD
Browse files Browse the repository at this point in the history
#1518 (comment)
pointed out that the previous untested fix doesn't work because
pthread_getthreadid_np() has a different signature on Darwin.

Follow up to b9707b7

Fixes #1518

PiperOrigin-RevId: 563432451
Change-Id: Id0a9212e9c4413fa520a42934efaed2a06ca5dbc
  • Loading branch information
derekmauro authored and copybara-github committed Sep 7, 2023
1 parent 2c4ce9b commit 1981cf8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion absl/base/internal/sysinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pid_t GetTID() {
return tid;
}

#elif defined(__APPLE__) || defined(__FreeBSD__)
#elif defined(__APPLE__)

pid_t GetTID() {
uint64_t tid;
Expand All @@ -440,6 +440,10 @@ pid_t GetTID() {
return static_cast<pid_t>(tid);
}

#elif defined(__FreeBSD__)

pid_t GetTID() { return static_cast<pid_t>(pthread_getthreadid_np()); }

#elif defined(__OpenBSD__)

pid_t GetTID() { return getthrid(); }
Expand Down

0 comments on commit 1981cf8

Please sign in to comment.