Click here to Skip to main content
16,007,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A Shading algorithm ? Pin
yarp21-Aug-02 21:54
yarp21-Aug-02 21:54 
GeneralChris Maudre Datagrid Pin
Mazdak21-Aug-02 5:35
Mazdak21-Aug-02 5:35 
GeneralRe: Chris Maudre Datagrid Pin
Chris Losinger21-Aug-02 5:36
professionalChris Losinger21-Aug-02 5:36 
GeneralRe: Chris Maudre Datagrid Pin
Mazdak21-Aug-02 7:29
Mazdak21-Aug-02 7:29 
Generalterminate a worker thread Pin
lucy21-Aug-02 5:31
lucy21-Aug-02 5:31 
GeneralRe: terminate a worker thread Pin
Tomasz Sowinski21-Aug-02 5:38
Tomasz Sowinski21-Aug-02 5:38 
GeneralRe: terminate a worker thread Pin
lucy21-Aug-02 6:01
lucy21-Aug-02 6:01 
GeneralRe: terminate a worker thread Pin
RChin21-Aug-02 23:43
RChin21-Aug-02 23:43 
When the worker thread terminates, the Object (CWinThread) will clean up and deallocate any resources associated with it, including itself. So after termination, the CWinThread variable will be invalid as stated.

To avoid this you will need to tell the class not to automatically delete itself on termination.

try this:

OnClose()
{
   // do not automatically delete me
   //
   m_hMyThread.m_bAutoDelete = FALSE; 

   m_bThreadRun = FALSE;   // signal thread for termination ..
   WaitForSingleObject(m_hMyThread, 1000); // .. and wait.

   delete m_hMyThread; // remember to clean up
   m_hMyThread = NULL; // not neccessary, but just to be clean.
}

GeneralRe: terminate a worker thread Pin
lucy22-Aug-02 2:41
lucy22-Aug-02 2:41 
GeneralRe: terminate a worker thread Pin
Chris Losinger21-Aug-02 5:41
professionalChris Losinger21-Aug-02 5:41 
GeneralRe: terminate a worker thread Pin
lucy21-Aug-02 6:08
lucy21-Aug-02 6:08 
GeneralRe: terminate a worker thread Pin
Chris Losinger21-Aug-02 6:16
professionalChris Losinger21-Aug-02 6:16 
GeneralRe: terminate a worker thread Pin
lucy21-Aug-02 7:17
lucy21-Aug-02 7:17 
Generalquick question about recordsets, ADO Pin
ns21-Aug-02 4:54
ns21-Aug-02 4:54 
GeneralRe: quick question about recordsets, ADO Pin
Ravi Bhavnani21-Aug-02 5:24
professionalRavi Bhavnani21-Aug-02 5:24 
GeneralRe: quick question about recordsets, ADO Pin
Ravi Bhavnani21-Aug-02 5:25
professionalRavi Bhavnani21-Aug-02 5:25 
GeneralRe: quick question about recordsets, ADO Pin
Blade[DMS]21-Aug-02 5:28
Blade[DMS]21-Aug-02 5:28 
GeneralI tried this, but Pin
ns21-Aug-02 5:36
ns21-Aug-02 5:36 
GeneralRe: I tried this, but Pin
Ravi Bhavnani21-Aug-02 5:39
professionalRavi Bhavnani21-Aug-02 5:39 
GeneralRe: I tried this, but Pin
ns21-Aug-02 5:46
ns21-Aug-02 5:46 
GeneralRe: I tried this, but Pin
Ravi Bhavnani21-Aug-02 5:51
professionalRavi Bhavnani21-Aug-02 5:51 
GeneralRe: I tried this, but Pin
Blade[DMS]21-Aug-02 5:49
Blade[DMS]21-Aug-02 5:49 
Generalthanks everyone. I used recordcount instead Pin
ns21-Aug-02 6:11
ns21-Aug-02 6:11 
GeneralRe: thanks everyone. I used recordcount instead Pin
Rashid Thadha21-Aug-02 6:21
Rashid Thadha21-Aug-02 6:21 
GeneralRe: I tried this, but Pin
Ranjan Banerji21-Aug-02 6:43
Ranjan Banerji21-Aug-02 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.