* Added function team_init_exit_info_on_error() which initializes the team's
exit info with some generic status. * team_create_thread_start(), common_thread_entry(): Initializes the team's exit info (if that's the main thread) before calling thread_exit(). Fixes #7686. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42183 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -36,6 +36,7 @@ char **user_team_get_arguments(void);
|
|||||||
int user_team_get_arg_count(void);
|
int user_team_get_arg_count(void);
|
||||||
struct job_control_entry* team_get_death_entry(Team *team,
|
struct job_control_entry* team_get_death_entry(Team *team,
|
||||||
thread_id child, bool* _deleteEntry);
|
thread_id child, bool* _deleteEntry);
|
||||||
|
void team_init_exit_info_on_error(Team* team);
|
||||||
bool team_is_valid(team_id id);
|
bool team_is_valid(team_id id);
|
||||||
Team *team_get_team_struct_locked(team_id id);
|
Team *team_get_team_struct_locked(team_id id);
|
||||||
int32 team_max_teams(void);
|
int32 team_max_teams(void);
|
||||||
|
|||||||
@@ -1577,6 +1577,7 @@ static status_t
|
|||||||
team_create_thread_start(void* args)
|
team_create_thread_start(void* args)
|
||||||
{
|
{
|
||||||
team_create_thread_start_internal(args);
|
team_create_thread_start_internal(args);
|
||||||
|
team_init_exit_info_on_error(thread_get_current_thread()->team);
|
||||||
thread_exit();
|
thread_exit();
|
||||||
// does not return
|
// does not return
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -3243,6 +3244,27 @@ team_set_job_control_state(Team* team, job_control_state newState,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! Inits the given team's exit information, if not yet initialized, to some
|
||||||
|
generic "killed" status.
|
||||||
|
The caller must not hold the team's lock. Interrupts must be enabled.
|
||||||
|
|
||||||
|
\param team The team whose exit info shall be initialized.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
team_init_exit_info_on_error(Team* team)
|
||||||
|
{
|
||||||
|
TeamLocker teamLocker(team);
|
||||||
|
|
||||||
|
if (!team->exit.initialized) {
|
||||||
|
team->exit.reason = CLD_KILLED;
|
||||||
|
team->exit.signal = SIGKILL;
|
||||||
|
team->exit.signaling_user = geteuid();
|
||||||
|
team->exit.status = 0;
|
||||||
|
team->exit.initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*! Adds a hook to the team that is called as soon as this team goes away.
|
/*! Adds a hook to the team that is called as soon as this team goes away.
|
||||||
This call might get public in the future.
|
This call might get public in the future.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -721,6 +721,10 @@ common_thread_entry(void* _args)
|
|||||||
if (args->enterUserland) {
|
if (args->enterUserland) {
|
||||||
enter_userspace(thread, (UserThreadEntryArguments*)args);
|
enter_userspace(thread, (UserThreadEntryArguments*)args);
|
||||||
// only returns or error
|
// only returns or error
|
||||||
|
|
||||||
|
// If that's the team's main thread, init the team exit info.
|
||||||
|
if (thread == thread->team->main_thread)
|
||||||
|
team_init_exit_info_on_error(thread->team);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're done
|
// we're done
|
||||||
|
|||||||
Reference in New Issue
Block a user