diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-13 19:42:34 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-13 19:42:34 -0700 |
| commit | 0ef01f36ecb47c795d13982a00ce9d9a6b30e934 (patch) | |
| tree | f49621e2d78ace58c8143b51663fe66a08f4d008 /include/linux | |
| parent | ad2bce43936c60dfe062b278e12e895a47a90409 (diff) | |
| parent | a5d2bf7b3b206f9d0c453618d02a5a0ede982c1d (diff) | |
Merge master.kernel.org:/home/acme/BK/llc-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/sched.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 337b2f396589..5a7e7c21009f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -760,14 +760,16 @@ static inline void remove_wait_queue_locked(wait_queue_head_t *q, #define remove_parent(p) list_del_init(&(p)->sibling) #define add_parent(p, parent) list_add_tail(&(p)->sibling,&(parent)->children) -#define REMOVE_LINKS(p) do { \ - list_del_init(&(p)->tasks); \ - remove_parent(p); \ +#define REMOVE_LINKS(p) do { \ + if (thread_group_leader(p)) \ + list_del_init(&(p)->tasks); \ + remove_parent(p); \ } while (0) -#define SET_LINKS(p) do { \ - list_add_tail(&(p)->tasks,&init_task.tasks); \ - add_parent(p, (p)->parent); \ +#define SET_LINKS(p) do { \ + if (thread_group_leader(p)) \ + list_add_tail(&(p)->tasks,&init_task.tasks); \ + add_parent(p, (p)->parent); \ } while (0) static inline struct task_struct *eldest_child(struct task_struct *p) @@ -797,11 +799,18 @@ static inline struct task_struct *younger_sibling(struct task_struct *p) #define next_task(p) list_entry((p)->tasks.next, struct task_struct, tasks) #define prev_task(p) list_entry((p)->tasks.prev, struct task_struct, tasks) -#define for_each_task(p) \ +#define for_each_process(p) \ for (p = &init_task ; (p = next_task(p)) != &init_task ; ) -#define for_each_thread(task) \ - for (task = next_thread(current) ; task != current ; task = next_thread(task)) +/* + * Careful: do_each_thread/while_each_thread is a double loop so + * 'break' will not work as expected - use goto instead. + */ +#define do_each_thread(g, t) \ + for (g = t = &init_task ; (g = t = next_task(g)) != &init_task ; ) do + +#define while_each_thread(g, t) \ + while ((t = next_thread(t)) != g) static inline task_t *next_thread(task_t *p) { |
