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

llvm-svn: 252696
This commit is contained in:
Ismail Pazarbasi 2015-11-11 02:44:19 +00:00
parent fcb8c7e407
commit 26f70505f3
1 changed files with 12 additions and 2 deletions

View File

@ -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;