From 2500c27b9234d09fbfea501ac835d26970205923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 13 Oct 2004 14:50:52 +0000 Subject: [PATCH] Began work for waitpid() functionality. Changed the way a dying thread propagates its exit status and reason: we no longer abuse the semaphore mechanism to carry an extra status value, instead, wait_for_thread() registers a death_entry with the thread that will be filled upon exit. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9322 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/thread_types.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/headers/private/kernel/thread_types.h b/headers/private/kernel/thread_types.h index 4fef5d1478..74701d2d7a 100644 --- a/headers/private/kernel/thread_types.h +++ b/headers/private/kernel/thread_types.h @@ -54,6 +54,14 @@ enum { struct image; // defined in image.c +struct death_entry { + struct list_link link; + team_id team; + thread_id thread; + status_t status; + uint32 reason; +}; + struct team { struct team *next; /* next team in the hash */ struct team *siblings_next; @@ -68,6 +76,8 @@ struct team { int pending_signals; void *io_context; sem_id death_sem; /* semaphore to wait on for dying threads */ + sem_id dead_child_sem; /* wait for dead child entries */ + struct list dead_children; vm_address_space *aspace; vm_address_space *kaspace; addr_t user_env_base; @@ -100,7 +110,6 @@ struct thread { sem_id sem_blocking; int sem_count; int sem_acquire_count; - int sem_deleted_retcode; int sem_errcode; int sem_flags; @@ -120,9 +129,13 @@ struct thread { thread_entry_func entry; void *args1, *args2; struct team *team; - status_t return_code; - sem_id return_code_sem; - int return_flags; + + struct { + sem_id sem; + status_t status; + uint32 reason; + struct list waiters; + } exit; // stack region_id kernel_stack_region_id;