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:
+42
-33
@@ -291,7 +291,7 @@ send_signal_etc(pid_t id, uint signal, uint32 flags)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
state = disable_interrupts();
|
state = disable_interrupts();
|
||||||
|
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
// send a signal to the specified thread
|
// send a signal to the specified thread
|
||||||
|
|
||||||
@@ -304,43 +304,52 @@ 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();
|
||||||
GRAB_TEAM_LOCK();
|
thread = thread_get_thread_struct_locked(id);
|
||||||
|
if (thread)
|
||||||
group = team_get_process_group_locked(team, id);
|
team = thread->team;
|
||||||
if (group != NULL) {
|
RELEASE_THREAD_LOCK();
|
||||||
struct team *team, *next;
|
}
|
||||||
|
|
||||||
// we need a safe way to get from the thread to the process group
|
if (team != NULL) {
|
||||||
// XXX whats this? id = thread->team->id;
|
struct process_group *group;
|
||||||
|
GRAB_TEAM_LOCK();
|
||||||
for (team = group->teams; team != NULL; team = next) {
|
|
||||||
next = team->group_next;
|
group = team_get_process_group_locked(team, id);
|
||||||
id = team->main_thread->id;
|
|
||||||
|
if (group != NULL) {
|
||||||
GRAB_THREAD_LOCK();
|
struct team *team, *next;
|
||||||
|
|
||||||
thread = thread_get_thread_struct_locked(id);
|
// we need a safe way to get from the thread to the process group
|
||||||
if (thread != NULL) {
|
|
||||||
// we don't stop because of an error sending the signal; we
|
for (team = group->teams; team != NULL; team = next) {
|
||||||
// rather want to send as much signals as possible
|
next = team->group_next;
|
||||||
status = deliver_signal(thread, signal, flags);
|
id = team->main_thread->id;
|
||||||
}
|
|
||||||
|
GRAB_THREAD_LOCK();
|
||||||
RELEASE_THREAD_LOCK();
|
|
||||||
}
|
thread = thread_get_thread_struct_locked(id);
|
||||||
|
if (thread != NULL) {
|
||||||
|
// we don't stop because of an error sending the signal; we
|
||||||
|
// rather want to send as much signals as possible
|
||||||
|
status = deliver_signal(thread, signal, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
RELEASE_THREAD_LOCK();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
RELEASE_TEAM_LOCK();
|
||||||
}
|
}
|
||||||
RELEASE_TEAM_LOCK();
|
|
||||||
GRAB_THREAD_LOCK();
|
GRAB_THREAD_LOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user