send_signal_etc() is now safe to be used on an SMP machine.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14523 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -256,8 +256,8 @@ notify_loading_app(status_t result, bool suspend)
|
|||||||
loadingInfo->done = true;
|
loadingInfo->done = true;
|
||||||
|
|
||||||
// we're done with the team stuff, get the thread lock instead
|
// we're done with the team stuff, get the thread lock instead
|
||||||
GRAB_THREAD_LOCK();
|
|
||||||
RELEASE_TEAM_LOCK();
|
RELEASE_TEAM_LOCK();
|
||||||
|
GRAB_THREAD_LOCK();
|
||||||
|
|
||||||
// wake up the waiting thread
|
// wake up the waiting thread
|
||||||
if (loadingInfo->thread->state == B_THREAD_SUSPENDED) {
|
if (loadingInfo->thread->state == B_THREAD_SUSPENDED) {
|
||||||
|
|||||||
@@ -318,12 +318,9 @@ send_signal_etc(pid_t id, uint signal, uint32 flags)
|
|||||||
group = team->group;
|
group = team->group;
|
||||||
|
|
||||||
for (team = group->teams; team != NULL; team = next) {
|
for (team = group->teams; team != NULL; team = next) {
|
||||||
// ToDo: there is a *big* race condition here on SMP machines;
|
|
||||||
// the team pointer will probably have gone bad in the mean time
|
|
||||||
next = team->group_next;
|
next = team->group_next;
|
||||||
id = team->main_thread->id;
|
id = team->main_thread->id;
|
||||||
|
|
||||||
RELEASE_TEAM_LOCK();
|
|
||||||
GRAB_THREAD_LOCK();
|
GRAB_THREAD_LOCK();
|
||||||
|
|
||||||
thread = thread_get_thread_struct_locked(id);
|
thread = thread_get_thread_struct_locked(id);
|
||||||
@@ -334,7 +331,6 @@ send_signal_etc(pid_t id, uint signal, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RELEASE_THREAD_LOCK();
|
RELEASE_THREAD_LOCK();
|
||||||
GRAB_TEAM_LOCK();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASE_TEAM_LOCK();
|
RELEASE_TEAM_LOCK();
|
||||||
@@ -342,7 +338,7 @@ send_signal_etc(pid_t id, uint signal, uint32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: maybe the scheduler should only be invoked is there is reason to do it?
|
// ToDo: maybe the scheduler should only be invoked if there is reason to do it?
|
||||||
// (ie. deliver_signal() moved some threads in the running queue?)
|
// (ie. deliver_signal() moved some threads in the running queue?)
|
||||||
if ((flags & B_DO_NOT_RESCHEDULE) == 0)
|
if ((flags & B_DO_NOT_RESCHEDULE) == 0)
|
||||||
scheduler_reschedule();
|
scheduler_reschedule();
|
||||||
|
|||||||
Reference in New Issue
Block a user