[PATCH] Implement `internal_start/join_thread` on Mac OS X
Alexander Potapenko
glider at google.com
Sat May 9 12:30:16 PDT 2015
Hi Ismail,
I'll take a look on Tuesday, sorry for the delay.
On Sat, May 9, 2015 at 9:31 AM, Ismail Pazarbasi
<ismail.pazarbasi at gmail.com> wrote:
> 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/
--
Alexander Potapenko
Software Engineer
Google Moscow
More information about the llvm-commits
mailing list