Terminate Execution with Multiple Threads

The process termination functions abort, exit, and _exit end all threads within the process, not just the thread that calls the termination function.

In general, you should allow only thread 1 to terminate a process, and only after all other threads have ended. However, if your program exits from a signal or exception handler it may be necessary to terminate the process from a thread other than thread 1.

A routine that resides in a DLL must not terminate the process, except in the case of a critical error. If the DLL and the executable for the process have different run-time libraries, terminating the process from the DLL would bypass any _onexit or atexit functions that the executable may have registered.



Multithreaded Applications
Signal and Exception Handling


Create and Delete Threads (Windows)
Create and Delete Threads (OS/2)


Asynchronous Exceptions
Signal and Exception Handlers in Multithreaded Applications