Edit

Share via


Warning C6258

Using TerminateThread does not allow proper thread clean up.

This warning indicates that a call to TerminateThread has been detected.

Remarks

TerminateThread is a dangerous function that should only be used in the most extreme cases. For more information about problems associated with TerminateThread call, see TerminateThread function.

Code analysis name: USINGTERMINATETHREAD

To properly terminate threads

  1. Create an event object using the CreateEvent function.

  2. Create the threads.

  3. Each thread monitors the event state by calling the WaitForSingleObject function.

  4. Each thread ends its own execution when the event is set to the signaled state (WaitForSingleObject returns WAIT_OBJECT_0).

See also