Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions include/envoy/common/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,17 @@ struct mmsghdr {
unsigned int msg_len;
};
#endif


#define SUPPORTS_PTHREAD_GETNAME_NP
Comment thread
buildbreaker marked this conversation as resolved.
Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest defining it to 1 or 0, rather than defining/not-defining it. That would make it less cumbersome to use in logical expressions at call-sites.

I think that's more consistent with other similar definitions in this file.

#ifdef __linux__
#undef SUPPORTS_PTHREAD_GETNAME_NP
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
#endif

// https://android.googlesource.com/platform/bionic/+/master/docs/status.md
// pthread_getname_np is introduced in API 26
#ifdef __ANDROID_API__
#if __ANDROID_API__ < 26
#undef SUPPORTS_PTHREAD_GETNAME_NP
#endif // __ANDROID_API__ < 26
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
#endif // ifdef __ANDROID_API__
2 changes: 1 addition & 1 deletion source/common/common/posix/thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ThreadImplPosix : public Thread {
}

private:
#ifdef __linux__
#ifdef SUPPORTS_PTHREAD_GETNAME_NP
Comment thread
buildbreaker marked this conversation as resolved.
Outdated
// Attempts to get the name from the operating system, returning true and
// updating 'name' if successful. Note that during normal operation this
// may fail, if the thread exits prior to the system call.
Expand Down