THREAD_DESTROY
Purpose
thread_destroy destroys
a thread.
Synopsis
#include <types.h>
#include <stub.h>
int thread_destroy(Capability
*thread, int exit_status);
Parameters
-
thread: the capability for the
thread to be destroyed;
-
exit_status: the status to be returned
to the thread calling thread_wait.
Description
thread_destroy destroys the thread
designated by thread. Destroying a thread includes detaching
its stack segment.
A status word present in exit_status
is stored inside the kernel and is passed to the first thread calling thread_wait.
The thread's descriptor structure is kept by the kernel until thread_wait
is called. Creating a thread and not waiting for its termination is not
a good policy, since the kernel may run out of thread descriptors.
Return Values
On success, thread_destroy returns
0 and the capability thread is no longer valid.
On fail, thread_destroy returns a negative
value indicating one of the following errors:
See Also
thread_create,
thread_status, thread_self,
thread_exit, thread_wait,
thread_priority, thread_suspend,
thread_resume, thread_sleep,
thread_yield