Re: how to end a thread from the main thread

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Mystique wrote:
> how to end a thread from the main thread

Ending a thread directly from another thread should always be
considered not an option.

If you want to end a UI thread, post a WM_CLOSE message to it and let
it terminate itself.
If you want to end a worker thread, use a variable to signal to the
thread that it's time to shut down.

If you need to wait until the thread is shutdown, wait on it's handle
in the main thread.

Which type of thread are you using?

Josh McFarlane

.



Relevant Pages

  • Getting the path of Temporary Internet Files
    ... How can I get the path of the Temporary Internet Files folder in MFC? ... Regards, ... Mystique ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • printing HTML from console application
    ... How can I print a HTML file with JavaScript from a console application? ... Regards, ... Mystique ... Prev by Date: ...
    (microsoft.public.vc.mfc)
  • Printing headers and/or footers
    ... How can i print multiline headers and/or footers in internet explorer 6? ... Regards, ... Mystique ... Prev by Date: ...
    (microsoft.public.win2000.printing)
  • Re: If Notre Dinero wins unimpressively..
    ... > ..are they still a lock to go BCSing in your mind? ... mystique, and marquee value. ... Prev by Date: ...
    (rec.sport.football.college)
  • Write to Registry
    ... I want to change my settings for header and footer for IE 6 ... Regards, ... Mystique ... Prev by Date: ...
    (microsoft.public.vc.mfc)