try to better handle signal for teams

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18885 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-09-18 22:51:07 +00:00
parent b8759025a9
commit 46a7b50c3b
+14 -5
View File
@@ -304,24 +304,32 @@ send_signal_etc(pid_t id, uint signal, uint32 flags)
// send a signal to the specified process group // send a signal to the specified process group
// (the absolute value of the id) // (the absolute value of the id)
struct team *team = thread_get_current_thread()->team; struct team *team = NULL;
struct process_group *group;
// TODO: handle -1 correctly // TODO: handle -1 correctly
if (id == 0 || id == -1) { if (id == 0 || id == -1) {
// send a signal to the current team // send a signal to the current team
id = thread_get_current_thread()->team->main_thread->id; team = thread_get_current_thread()->team;
} else id = team->main_thread->id;
} else {
id = -id; id = -id;
GRAB_THREAD_LOCK();
thread = thread_get_thread_struct_locked(id);
if (thread)
team = thread->team;
RELEASE_THREAD_LOCK();
}
if (team != NULL) {
struct process_group *group;
GRAB_TEAM_LOCK(); GRAB_TEAM_LOCK();
group = team_get_process_group_locked(team, id); group = team_get_process_group_locked(team, id);
if (group != NULL) { if (group != NULL) {
struct team *team, *next; struct team *team, *next;
// we need a safe way to get from the thread to the process group // we need a safe way to get from the thread to the process group
// XXX whats this? id = thread->team->id;
for (team = group->teams; team != NULL; team = next) { for (team = group->teams; team != NULL; team = next) {
next = team->group_next; next = team->group_next;
@@ -341,6 +349,7 @@ send_signal_etc(pid_t id, uint signal, uint32 flags)
} }
RELEASE_TEAM_LOCK(); RELEASE_TEAM_LOCK();
}
GRAB_THREAD_LOCK(); GRAB_THREAD_LOCK();
} }