When a main thread (i.e. a team) dies, we have to send the SIGCHLD to

its parent while still holding the team spinlock. We were racing with
wait_for_child(), since after the child invoked
team_set_job_control_state(), the parent thread could continue as soon
as the team spinlock was released. The SIGCHLD could thus arrive way
later and interrupt another syscall. This could be reproduced with the
compile_bench.sh script from time to time: When interrupted while
waiting for the next subprocess, the gcc frontend would delete a still
needed temporary file.

The whole thing is actually only a problem, because we don't support
automatic syscall restarts yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23625 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-01-18 23:39:13 +00:00
parent c964a2f228
commit 46cb5cfdd3

View File

@ -1281,6 +1281,9 @@ thread_exit(void)
RELEASE_THREAD_LOCK();
team_remove_team(team, &freeGroup);
send_signal_etc(parentID, SIGCHLD,
SIGNAL_FLAG_TEAMS_LOCKED | B_DO_NOT_RESCHEDULE);
} else {
// The thread is not the main thread. We store a thread death
// entry for it, unless someone is already waiting it.
@ -1327,7 +1330,6 @@ thread_exit(void)
if (death != NULL)
delete death;
send_signal_etc(parentID, SIGCHLD, B_DO_NOT_RESCHEDULE);
cachedDeathSem = -1;
}