[compiler-rt] r252696 - Implement `internal_start/join_thread` on Mac OS X
Ismail Pazarbasi via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 10 18:44:19 PST 2015
Author: ismailp
Date: Tue Nov 10 20:44:19 2015
New Revision: 252696
URL: http://llvm.org/viewvc/llvm-project?rev=252696&view=rev
Log:
Implement `internal_start/join_thread` on Mac OS X
Summary: Depends on D9637
Test Plan:
Reviewers: kcc, glider, samsonov
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9638
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=252696&r1=252695&r2=252696&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Tue Nov 10 20:44:19 2015
@@ -371,8 +371,18 @@ uptr GetRSS() {
return info.resident_size;
}
-void *internal_start_thread(void (*func)(void *arg), void *arg) { return 0; }
-void internal_join_thread(void *th) { }
+void *internal_start_thread(void(*func)(void *arg), void *arg) {
+ // Start the thread with signals blocked, otherwise it can steal user signals.
+ __sanitizer_sigset_t set, old;
+ internal_sigfillset(&set);
+ internal_sigprocmask(SIG_SETMASK, &set, &old);
+ pthread_t th;
+ pthread_create(&th, 0, (void*(*)(void *arg))func, arg);
+ internal_sigprocmask(SIG_SETMASK, &old, 0);
+ return th;
+}
+
+void internal_join_thread(void *th) { pthread_join((pthread_t)th, 0); }
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
ucontext_t *ucontext = (ucontext_t*)context;
More information about the llvm-commits
mailing list