Click here to Skip to main content
15,888,733 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to wait for thread & if no response within time abort it Pin
David Crow15-Sep-05 7:43
David Crow15-Sep-05 7:43 
GeneralRe: How to wait for thread & if no response within time abort it Pin
ThatsAlok15-Sep-05 18:15
ThatsAlok15-Sep-05 18:15 
GeneralRe: How to wait for thread & if no response within time abort it Pin
David Crow16-Sep-05 2:18
David Crow16-Sep-05 2:18 
AnswerRe: How to wait for thread & if no response within time abort it Pin
Roger Stoltz14-Sep-05 21:45
Roger Stoltz14-Sep-05 21:45 
GeneralRe: How to wait for thread & if no response within time abort it Pin
karmendra_js14-Sep-05 22:04
karmendra_js14-Sep-05 22:04 
GeneralRe: How to wait for thread & if no response within time abort it Pin
HumanOsc14-Sep-05 22:40
HumanOsc14-Sep-05 22:40 
AnswerRe: How to wait for thread & if no response within time abort it Pin
karmendra_js14-Sep-05 23:03
karmendra_js14-Sep-05 23:03 
GeneralRe: How to wait for thread & if no response within time abort it Pin
Roger Stoltz14-Sep-05 23:22
Roger Stoltz14-Sep-05 23:22 
HumanOsc wrote:
This is wrong, ExitThread must be always called from that thread which should be end... That means inside the worker thread...

Of course this is wrong! My mistake.
I virtually never use these functions to end a thread, I consider it a design problem and always try to find another solution, like you suggested.
I was too lazy to look up the name of the function I was looking for and mistook ::TerminateThread for ::ExitThread.
Really sorry.Blush | :O
Calling ::ExitThread does just what it sounds like: it exits the calling thread, like the main thread if the call is made from it.

However, the use of ::TerminateThread is not recommended since it too does what the name of the function sounds like: it terminates the thread in question.
"Terminate" as in Arnold Schwarzenegger "Hasta la vista, baby!" without letting the system reclaim allocated resources such as critical sections, heap, loaded DLLs and so on.
Due to the possible side effects of this function I always try to find another solution by refactoring.
I still consider the original problem a design problem.
--
Roger
GeneralRe: How to wait for thread & if no response within time abort it Pin
karmendra_js14-Sep-05 23:43
karmendra_js14-Sep-05 23:43 
GeneralRe: How to wait for thread & if no response within time abort it Pin
Roger Stoltz15-Sep-05 1:53
Roger Stoltz15-Sep-05 1:53 
QuestionAbout CString : Plz Send Urgently Pin
parims14-Sep-05 19:08
parims14-Sep-05 19:08 
AnswerRe: About CString : Plz Send Urgently Pin
karmendra_js14-Sep-05 19:45
karmendra_js14-Sep-05 19:45 
AnswerRe: About CString : Plz Send Urgently Pin
prasad_som14-Sep-05 19:51
prasad_som14-Sep-05 19:51 
AnswerRe: About CString : Plz Send Urgently Pin
kakan14-Sep-05 20:03
professionalkakan14-Sep-05 20:03 
AnswerRe: About CString : Plz Send Urgently Pin
vikas amin15-Sep-05 1:11
vikas amin15-Sep-05 1:11 
JokeRe: About CString : Plz Send Urgently Pin
prasad_som15-Sep-05 2:16
prasad_som15-Sep-05 2:16 
AnswerRe: About CString : Plz Send Urgently Pin
YoSilver15-Sep-05 14:35
YoSilver15-Sep-05 14:35 
GeneralRe: About CString : Plz Send Urgently Pin
ThatsAlok15-Sep-05 18:11
ThatsAlok15-Sep-05 18:11 
Questionwhy does only a part of VARIANT change from VT_DATE to VT_BSTR? Pin
liuyue14-Sep-05 18:43
liuyue14-Sep-05 18:43 
Questionwrite Text on sphere Pin
cofd14-Sep-05 18:42
cofd14-Sep-05 18:42 
AnswerRe: write Text on sphere Pin
User 58385214-Sep-05 18:46
User 58385214-Sep-05 18:46 
GeneralRe: write Text on sphere Pin
cofd14-Sep-05 19:00
cofd14-Sep-05 19:00 
GeneralRe: write Text on sphere Pin
cofd14-Sep-05 19:11
cofd14-Sep-05 19:11 
Questiona vss question Pin
followait14-Sep-05 17:39
followait14-Sep-05 17:39 
QuestionI've written a service and it can't access mapped network drives. Why? Pin
zhaopi14-Sep-05 17:26
zhaopi14-Sep-05 17:26 

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.