Skip to content

Commit

Permalink
i#58 MacOS: thread_signal()
Browse files Browse the repository at this point in the history
Use SYS___pthread_kill as there is no SYS_tgkill on Mac.
Not finished, though: we need to map a thread id to a mach port.

SVN-Revision: 2452
  • Loading branch information
derekbruening committed Jan 9, 2014
1 parent 4c27927 commit 78b8243
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/unix/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,13 +2503,21 @@ os_thread_yield()
static bool
thread_signal(process_id_t pid, thread_id_t tid, int signum)
{
#ifdef MACOS
/* FIXME i#58: this takes in a thread port. Need to map thread id to port.
* Need to figure out whether we support raw Mach threads w/o pthread on top.
*/
ASSERT_NOT_IMPLEMENTED(false);
return (dynamorio_syscall(SYS___pthread_kill, 2, tid, signum) == 0);
#else
/* FIXME: for non-NPTL use SYS_kill */
/* Note that the pid is equivalent to the thread group id.
* However, we can have threads sharing address space but not pid
* (if created via CLONE_VM but not CLONE_THREAD), so make sure to
* use the pid of the target thread, not our pid.
*/
return (dynamorio_syscall(SYS_tgkill, 3, pid, tid, signum) == 0);
#endif
}

void
Expand Down

0 comments on commit 78b8243

Please sign in to comment.