Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # User Andrew Paprocki <[email protected]>
- # Date 1429932392 14400
- # Fri Apr 24 23:26:32 2015 -0400
- # Node ID df67e9784e4089fe57653aa766c893ac60b6bdd4
- # Parent ccd270cfe90bd2ee68a3865fcf1c06175f6f9f00
- Bug 1107944 - Support setting thread name on systems without glibc-2.12. r=jorendorff
- diff --git a/js/src/vm/PosixNSPR.cpp b/js/src/vm/PosixNSPR.cpp
- --- a/js/src/threading/posix/Thread.cpp
- +++ b/js/src/threading/posix/Thread.cpp
- @@ -159,8 +159,14 @@
- rv = 0;
- #elif defined(__NetBSD__)
- rv = pthread_setname_np(pthread_self(), "%s", (void*)name);
- +#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 12)
- + rv = pthread_setname_np(pthread_self(), name);
- +#elif defined(__linux) && defined(PR_SET_NAME)
- + // PR_SET_NAME was added in Linux 2.6.9 and is the fallback when the
- + // newer pthread_setname_np() added in glibc-2.12 is not available.
- + rv = prctl(PR_SET_NAME, (unsigned long)(uintptr_t)name, 0, 0, 0);
- #else
- - rv = pthread_setname_np(pthread_self(), name);
- + rv = -1;
- #endif
- MOZ_RELEASE_ASSERT(!rv);
- }
Advertisement
Add Comment
Please, Sign In to add comment