Partager via


CMsgThread::WaitForThreadExit

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Blocks until the thread exits.

Syntax

BOOL WaitForThreadExit(
  LPDWORD lpdwExitCode 
);

Parameters

  • lpdwExitCode
    Exit code returned by the thread.

Return Value

Returns either TRUE or FALSE, the meaning of which is determined by the class supplying the overridden CMsgThread::ThreadMessageProc member function and the calling member function.

Remarks

Be sure the worker thread has exited completely before completing the destruction of your derived class; otherwise, the thread might still execute after your dynamic-link library (DLL) has been unloaded from the address space of the process.

Even if the only instruction left to exit is a single-return instruction, this would cause an exception.

The only reliable way to ensure that the thread has exited is to signal the thread to exit (using a privately negotiated CMsg object sent to the CMsgThread::PutThreadMsg member function) and then call this member function.

Do this in the destructor for your derived class.

Requirements

Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later
Note Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements
For more information, see Setting Up the Build Environment, Version 2.12 requires DXPAK 1.0 or later