diff options
author | Ismail Pazarbasi <ismail.pazarbasi@gmail.com> | 2015-11-11 02:44:19 +0000 |
---|---|---|
committer | Ismail Pazarbasi <ismail.pazarbasi@gmail.com> | 2015-11-11 02:44:19 +0000 |
commit | 7e5530f11546b4de801d17a4ba62748364e698e5 (patch) | |
tree | 79faf2a22da347ce14fe753982be9b9ea90df111 /lib/sanitizer_common/sanitizer_mac.cc | |
parent | 2ee17a6b61c600410dbe80521dfa94b1676efcc5 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_mac.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_mac.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc index 3151cf8b9..03e97c84e 100644 --- a/lib/sanitizer_common/sanitizer_mac.cc +++ b/lib/sanitizer_common/sanitizer_mac.cc @@ -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; |