Process groups are now reference-counted. Processes in a group as well

as the death entries of a deceased processes that were in this group
and have not yet been reaped hold references to the group, so that it
won't be deleted until the group is empty and all gone group members
have been reaped. This fixes #1799 at last.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24335 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-03-09 17:56:27 +00:00
parent 32da50fafb
commit 4a7f236b07
4 changed files with 156 additions and 71 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ status_t team_init(struct kernel_args *args);
team_id team_create_team(const char *path, const char *name, char **args,
int argc, char **envp, int envc, int priority);
status_t wait_for_team(team_id id, status_t *returnCode);
void team_remove_team(struct team *team, struct process_group **_freeGroup);
void team_remove_team(struct team *team);
void team_delete_team(struct team *team);
struct process_group *team_get_process_group_locked(
struct process_session *session, pid_t id);
+9
View File
@@ -80,6 +80,7 @@ struct process_group {
struct process_group *next; // next in hash
struct process_session *session;
pid_t id;
int32 refs;
struct team *teams;
bool orphaned;
};
@@ -115,6 +116,7 @@ typedef struct job_control_entry job_control_entry;
struct job_control_entry : DoublyLinkedListLinkImpl<job_control_entry> {
job_control_state state; // current team job control state
thread_id thread; // main thread ID == team ID
bool has_group_ref;
// valid while state != JOB_CONTROL_STATE_DEAD
struct team* team;
@@ -124,6 +126,13 @@ struct job_control_entry : DoublyLinkedListLinkImpl<job_control_entry> {
status_t status;
uint16 reason;
uint16 signal;
job_control_entry();
~job_control_entry();
void InitDeadState();
job_control_entry& operator=(const job_control_entry& other);
};
typedef DoublyLinkedList<job_control_entry> JobControlEntryList;