For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Terminates a thread;
_endthread terminates a thread that's created by
_endthreadex terminates a thread that's created by
void _endthread( void ); void _endthreadex( unsigned retval );
Thread exit code.
You can call
_endthreadex explicitly to terminate a thread; however,
_endthreadex is called automatically when the thread returns from the routine passed as a parameter to
_beginthreadex. Terminating a thread with a call to
_endthreadex helps ensure proper recovery of resources allocated for the thread.
For an executable file linked with Libcmt.lib, do not call the Win32 ExitThread API; this prevents the run-time system from reclaiming allocated resources.
_endthread automatically closes the thread handle. (This behavior differs from the Win32
ExitThread API.) Therefore, when you use
_endthread, do not explicitly close the thread handle by calling the Win32 CloseHandle API.
Like the Win32
_endthreadex does not close the thread handle. Therefore, when you use
_endthreadex, you must close the thread handle by calling the Win32
For more compatibility information, see Compatibility.
Multithreaded versions of the C run-time libraries only.
See the example for _beginthread.
Not applicable. To call the standard C function, use
PInvoke. For more information, see Platform Invoke Examples.