exit_thread


void exit_thread(unsigned code)

This function exits the calling thread.

Parameters

unsigned code

The exit code for the thread.

Notes

The function get_thread_exit_code may be used to obtain the exit code of a thread.

The thread's stack is deallocated. The entry point of all dynamic link libraries attached to the process is called with a value indicating that a thread is terminating. Exiting a thread does not remove the thread from the system. The thread is removed from the system when the last handle for the thread is closed. A thread handle is closed upon calling the function close_handle.

Upon exit, the thread's handle enters the signalled state, causing any other threads waiting upon its handle to be released.

If this is the last thread for the process, the process is also terminated.

See notes for the function create_thread for comments regarding serialization of certain functions.