[PATCH] Implement `internal_start/join_thread` on Mac OS X
Ismail Pazarbasi
ismail.pazarbasi at gmail.com
Sat May 9 09:31:45 PDT 2015
Hi kcc, glider, samsonov,
Depends on D9637
http://reviews.llvm.org/D9638
Files:
lib/sanitizer_common/sanitizer_mac.cc
Index: lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- lib/sanitizer_common/sanitizer_mac.cc
+++ lib/sanitizer_common/sanitizer_mac.cc
@@ -336,8 +336,26 @@
return 0;
}
-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) {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+ // 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);
+ void *th;
+ real_pthread_create(&th, 0, (void*(*)(void *arg))func, arg);
+ internal_sigprocmask(SIG_SETMASK, &old, 0);
+ return th;
+#else
+ return 0;
+#endif
+}
+
+void internal_join_thread(void *th) {
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+ real_pthread_join(th, 0);
+#endif
+}
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
ucontext_t *ucontext = (ucontext_t*)context;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9638.25412.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150509/851de66f/attachment.bin>
More information about the llvm-commits
mailing list