diff options
Diffstat (limited to 'kern/thread.h')
-rw-r--r-- | kern/thread.h | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/kern/thread.h b/kern/thread.h index 3959dfce..0e85d8c4 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -70,6 +70,22 @@ struct thread { task_t task; /* Task to which I belong */ queue_chain_t thread_list; /* list of threads in task */ + /* Flags */ + /* The flags are grouped here, but documented at the original + position. */ + union { + struct { + unsigned state:16; + unsigned wake_active:1; + unsigned vm_privilege:1; + unsigned active:1; + }; + event_t event_key; +/* These keys can be used with thread_wakeup and friends. */ +#define TH_EV_WAKE_ACTIVE(t) ((event_t) (&(t)->event_key + 0)) +#define TH_EV_STATE(t) ((event_t) (&(t)->event_key + 1)) + }; + /* Thread bookkeeping */ queue_chain_t pset_threads; /* list of all threads in proc set*/ @@ -92,9 +108,10 @@ struct thread { kern_return_t wait_result; /* outcome of wait - may be examined by this thread WITHOUT locking */ - boolean_t wake_active; /* someone is waiting for this + /* Defined above */ + /* boolean_t wake_active; someone is waiting for this thread to become suspended */ - int state; /* Thread state: */ + /* int state; Thread state: */ /* * Thread states [bits or'ed] */ @@ -129,7 +146,8 @@ struct thread { /* VM global variables */ vm_offset_t recover; /* page fault recovery (copyin/out) */ - boolean_t vm_privilege; /* Can use reserved memory? */ + /* Defined above */ + /* boolean_t vm_privilege; Can use reserved memory? */ /* User-visible scheduling state */ int user_stop_count; /* outstanding stops */ @@ -194,7 +212,8 @@ struct thread { timer_elt_data_t depress_timer; /* timer for priority depression */ /* Ast/Halt data structures */ - boolean_t active; /* how alive is the thread */ + /* Defined above */ + /* boolean_t active; how alive is the thread */ int ast; /* ast's needed. See ast.h */ /* Processor data structures */ @@ -259,6 +278,13 @@ extern kern_return_t thread_create( thread_t *child_thread); extern kern_return_t thread_terminate( thread_t thread); +extern kern_return_t thread_terminate_release( + thread_t thread, + task_t task, + mach_port_t thread_name, + mach_port_t reply_port, + vm_offset_t address, + vm_size_t size); extern kern_return_t thread_suspend( thread_t thread); extern kern_return_t thread_resume( @@ -338,14 +364,12 @@ extern kern_return_t thread_halt( boolean_t must_halt); extern void thread_halt_self(void); extern void thread_force_terminate(thread_t); -extern void thread_set_own_priority( - int priority); extern thread_t kernel_thread( task_t task, void (*start)(void), void * arg); -extern void reaper_thread(void); +extern void reaper_thread(void) __attribute__((noreturn)); #if MACH_HOST extern void thread_freeze( @@ -384,4 +408,9 @@ extern void thread_unfreeze( #define current_space() (current_task()->itk_space) #define current_map() (current_task()->map) +#if MACH_DEBUG +void stack_init(vm_offset_t stack); +void stack_finalize(vm_offset_t stack); +#endif /* MACH_DEBUG */ + #endif /* _KERN_THREAD_H_ */ |