diff options
| author | Ingo Molnar <mingo@elte.hu> | 2002-09-12 21:36:11 -0700 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2002-09-12 21:36:11 -0700 |
| commit | 2c66151cbc2cc68465489fdf64d16bd1c6ca4d0e (patch) | |
| tree | a726906587dfd198db17c02be4694e617e7a9401 /include/linux | |
| parent | f2e3a5d66f21eacafe15a846f2010200ed0cb8b6 (diff) | |
[PATCH] sys_exit() threading improvements, BK-curr
This implements the 'keep the initial thread around until every thread
in the group exits' concept in a different, less intrusive way, along
your suggestions. There is no exit_done completion handling anymore,
freeing of the task is still done by wait4(). This has the following
side-effect: detached threads/processes can only be started within a
thread group, not in a standalone way.
(This also fixes the bugs introduced by the ->exit_done code, which made
it possible for a zombie task to be reactivated.)
I've introduced the p->group_leader pointer, which can/will be used for
other purposes in the future as well - since from now on the thread
group leader is always existent. Right now it's used to notify the
parent of the thread group leader from the last non-leader thread that
exits [if the thread group leader is a zombie already].
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/init_task.h | 1 | ||||
| -rw-r--r-- | include/linux/sched.h | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index bdf03241a009..c66cbf8d9f5c 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -61,6 +61,7 @@ .parent = &tsk, \ .children = LIST_HEAD_INIT(tsk.children), \ .sibling = LIST_HEAD_INIT(tsk.sibling), \ + .group_leader = &tsk, \ .thread_group = LIST_HEAD_INIT(tsk.thread_group), \ .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(tsk.wait_chldexit),\ .real_timer = { \ diff --git a/include/linux/sched.h b/include/linux/sched.h index bdce46f40af2..513c065e281c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -219,8 +219,6 @@ struct signal_struct { /* thread group exit support */ int group_exit; int group_exit_code; - - struct completion group_exit_done; }; /* @@ -316,6 +314,7 @@ struct task_struct { struct task_struct *parent; /* parent process */ struct list_head children; /* list of my children */ struct list_head sibling; /* linkage in my parent's children list */ + struct task_struct *group_leader; struct list_head thread_group; /* PID hash table linkage. */ @@ -827,6 +826,9 @@ static inline task_t *prev_thread(task_t *p) #define thread_group_leader(p) (p->pid == p->tgid) +#define delay_group_leader(p) \ + (p->tgid == p->pid && !list_empty(&p->thread_group)) + extern void unhash_process(struct task_struct *p); /* Protects ->fs, ->files, ->mm, and synchronises with wait4(). Nests inside tasklist_lock */ |
