Board index » cppbuilder » TThread +GetExitCodeThread()
George
![]() CBuilder Developer |
George
![]() CBuilder Developer |
TThread +GetExitCodeThread()2005-01-22 03:44:14 AM cppbuilder76 hi all, I'm trying to use GetExitCodeThread() with my TThread object unsigned long ex; GetExitCodeThread(showThread, &ex); if(ex==STILL_ACTIVE) { ExitThread(ex); } but it never gives me STILL_ACTIVE though I'm sure it's not exited, because I have while(1); inside a thread; can someone have a look please? |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-01-22 04:54:36 AM
Re:TThread +GetExitCodeThread()
"George" < XXXX@XXXXX.COM >wrote in message
QuoteI'm trying to use GetExitCodeThread() thread itself? If so, then you cannot do that. Quotebut it never gives me STILL_ACTIVE Quotethough I'm sure it's not exited, because I have while(1); inside a thread; code, so I cannot tell you whether you are using GetExitCodeThread() properly in the first place. Gambit |
George
![]() CBuilder Developer |
2005-01-22 09:23:17 PM
Re:TThread +GetExitCodeThread()
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
sorry for being so unclear!!! ShowPending *showThread=NULL; //where ShowPending is my TThread object.!!! //and it's global variable; Quote>but it never gives me STILL_ACTIVE Quotecode, so I cannot tell you whether you are using GetExitCodeThread() {smallsort} |
George
![]() CBuilder Developer |
2005-01-23 12:26:43 AM
Re:TThread +GetExitCodeThread()
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
I was passing GetExitCodeThread() wrong handle. I was passing TThread object itself. I needed (void *)showThread->Handle now it returns STILL_ACTIVE thanks for help Remy |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-01-24 07:33:02 AM
Re:TThread +GetExitCodeThread()
"George" < XXXX@XXXXX.COM >wrote in message
QuoteShowPending *showThread=NULL; to a class instead. Your call to GetExitCodeThread() needs to look more like the following instead: GetExitCodeThread((HANDLE)showThread->Handle, &ex); Also, you are not checking the return value of GetExitCodeThread() to see whether it fails or succeeds at all. You should always check the return values of API functions to detect errors. For example: if( GetExitCodeThread((HANDLE)showThread->Handle, &ex) ) // use ex as needed... else // failed to query the exit code, use GetLastError() to find out why... Gambit |