diff options
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index ffccdad050b5..485234d2fd42 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -549,6 +549,7 @@ struct signal_struct { | |||
549 | atomic_t sigcnt; | 549 | atomic_t sigcnt; |
550 | atomic_t live; | 550 | atomic_t live; |
551 | int nr_threads; | 551 | int nr_threads; |
552 | struct list_head thread_head; | ||
552 | 553 | ||
553 | wait_queue_head_t wait_chldexit; /* for wait4() */ | 554 | wait_queue_head_t wait_chldexit; /* for wait4() */ |
554 | 555 | ||
@@ -1271,6 +1272,7 @@ struct task_struct { | |||
1271 | /* PID/PID hash table linkage. */ | 1272 | /* PID/PID hash table linkage. */ |
1272 | struct pid_link pids[PIDTYPE_MAX]; | 1273 | struct pid_link pids[PIDTYPE_MAX]; |
1273 | struct list_head thread_group; | 1274 | struct list_head thread_group; |
1275 | struct list_head thread_node; | ||
1274 | 1276 | ||
1275 | struct completion *vfork_done; /* for vfork() */ | 1277 | struct completion *vfork_done; /* for vfork() */ |
1276 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ | 1278 | int __user *set_child_tid; /* CLONE_CHILD_SETTID */ |
@@ -2341,6 +2343,16 @@ extern bool current_is_single_threaded(void); | |||
2341 | #define while_each_thread(g, t) \ | 2343 | #define while_each_thread(g, t) \ |
2342 | while ((t = next_thread(t)) != g) | 2344 | while ((t = next_thread(t)) != g) |
2343 | 2345 | ||
2346 | #define __for_each_thread(signal, t) \ | ||
2347 | list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node) | ||
2348 | |||
2349 | #define for_each_thread(p, t) \ | ||
2350 | __for_each_thread((p)->signal, t) | ||
2351 | |||
2352 | /* Careful: this is a double loop, 'break' won't work as expected. */ | ||
2353 | #define for_each_process_thread(p, t) \ | ||
2354 | for_each_process(p) for_each_thread(p, t) | ||
2355 | |||
2344 | static inline int get_nr_threads(struct task_struct *tsk) | 2356 | static inline int get_nr_threads(struct task_struct *tsk) |
2345 | { | 2357 | { |
2346 | return tsk->signal->nr_threads; | 2358 | return tsk->signal->nr_threads; |