Changed the team shutdown process a bit:
* The threads beside the main thread are killed earlier now (in the new team_shutdown_team()), before removing the team from the team hash and from its process group. This fixes #5296. * Use a condition variable instead of a semaphore to wait for the non-main threads to die. We notify the condition right after a thread has left the team. The semaphore was released by the undertaker. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35196 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,7 +23,8 @@ extern "C" {
|
||||
status_t team_init(struct kernel_args *args);
|
||||
status_t wait_for_team(team_id id, status_t *returnCode);
|
||||
void team_remove_team(struct team *team);
|
||||
void team_delete_team(struct team *team);
|
||||
port_id team_shutdown_team(struct team *team, cpu_status& state);
|
||||
void team_delete_team(struct team *team, port_id debuggerPort);
|
||||
struct process_group *team_get_process_group_locked(
|
||||
struct process_session *session, pid_t id);
|
||||
void team_delete_process_group(struct process_group *group);
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
|
||||
#ifndef _ASSEMBLER
|
||||
|
||||
#include <smp.h>
|
||||
#include <arch/thread_types.h>
|
||||
#include <condition_variable.h>
|
||||
#include <signal.h>
|
||||
#include <smp.h>
|
||||
#include <thread_defs.h>
|
||||
#include <timer.h>
|
||||
#include <user_debugger.h>
|
||||
#include <util/list.h>
|
||||
#include <arch/thread_types.h>
|
||||
|
||||
|
||||
extern spinlock gThreadSpinlock;
|
||||
@@ -98,6 +99,7 @@ struct team_watcher {
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
||||
#define MAX_DEAD_CHILDREN 32
|
||||
// this is a soft limit for the number of child death entries in a team
|
||||
#define MAX_DEAD_THREADS 32
|
||||
@@ -150,6 +152,12 @@ struct team_dead_children : team_job_control_children {
|
||||
};
|
||||
|
||||
|
||||
struct team_death_entry {
|
||||
int32 remaining_threads;
|
||||
ConditionVariable condition;
|
||||
};
|
||||
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
@@ -178,7 +186,7 @@ struct team {
|
||||
struct io_context *io_context;
|
||||
struct realtime_sem_context *realtime_sem_context;
|
||||
struct xsi_sem_context *xsi_sem_context;
|
||||
sem_id death_sem; // semaphore to wait on for dying threads
|
||||
struct team_death_entry *death_entry;
|
||||
struct list dead_threads;
|
||||
int dead_threads_count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user