wait_for_child() could eventually hang until another team exited (or forever if

it waited for a specific child), as B_RELEASE_ALL opened up a race condition between
looking for an existing death entry, and waiting for the dead children semaphore.
Now we're counting all waiting threads for teams and groups separately.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18543 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-08-20 21:27:12 +00:00
parent 4fdb58bec0
commit 2b6a368811
3 changed files with 42 additions and 25 deletions
+7 -5
View File
@@ -66,6 +66,7 @@ struct process_group {
pid_t id;
sem_id dead_child_sem;
int32 wait_for_any;
int32 dead_child_waiters; // count of threads waiting for sem
struct team *teams;
};
@@ -96,16 +97,17 @@ struct team {
struct process_group *group;
char name[B_OS_NAME_LENGTH];
char args[64]; // contents for the team_info::args field
int num_threads; /* number of threads in this team */
int state; /* current team state, see above */
int num_threads; // number of threads in this team
int state; // current team state, see above
int pending_signals;
void *io_context;
sem_id death_sem; /* semaphore to wait on for dying threads */
sem_id death_sem; // semaphore to wait on for dying threads
struct {
sem_id sem; /* wait for dead child entries */
sem_id sem; // wait for dead child entries
struct list list;
uint32 count;
int32 wait_for_any; /* count of wait_for_child() that wait for any child */
vint32 wait_for_any; // count of wait_for_child() that wait for any child
int32 waiters; // count of all threads waiting for dead children sem
bigtime_t kernel_time;
bigtime_t user_time;
} dead_children;