Click here to Skip to main content
15,891,943 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralReading text file Pin
hongheo762-Aug-02 1:12
hongheo762-Aug-02 1:12 
GeneralRe: Reading text file Pin
Tomasz Sowinski2-Aug-02 1:23
Tomasz Sowinski2-Aug-02 1:23 
QuestionHow to force a thread to end?? Pin
Olli2-Aug-02 0:42
Olli2-Aug-02 0:42 
AnswerRe: How to force a thread to end?? Pin
Tomasz Sowinski2-Aug-02 0:46
Tomasz Sowinski2-Aug-02 0:46 
GeneralRe: How to force a thread to end?? Pin
Olli2-Aug-02 3:05
Olli2-Aug-02 3:05 
AnswerRe: How to force a thread to end?? Pin
Navin2-Aug-02 3:08
Navin2-Aug-02 3:08 
GeneralRe: How to force a thread to end?? Pin
Olli2-Aug-02 3:16
Olli2-Aug-02 3:16 
GeneralRe: How to force a thread to end?? Pin
Daniel Lohmann2-Aug-02 3:53
Daniel Lohmann2-Aug-02 3:53 
Sorry, but seems that you are a bit out of luck here Frown | :-(

The problem is certainly the poor CFtpConnection implementation. If it blocks and never returns you just can't do a clean termination of the thread. You never now what exactly has been allocated and how to destroy these resources.

IMHO there are only two options:

1) Get rid of the damned CFtpConnection thing and choose a class that deals better. (I don't know any alternative, though I'm quite sure they exist!)

2) Kill your thread with TerminateThread(). Of course it will cause leaks. If this happens only in very rare conditions this might be acceptable. If your process is "long-running" it would be a good idea to count the number of killed threads and restart the whole process if it reaches a defined number (e.g. 10 or 20).
Yes, it's crappy Dead | X| - but it works and has no real harm to the system. All resources are cleaned up automatically on process termination.

--

Daniel Lohmann

http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there Big Grin | :-D )
GeneralRe: How to force a thread to end?? Pin
Todd Smith2-Aug-02 4:48
Todd Smith2-Aug-02 4:48 
GeneralRe: How to force a thread to end?? Pin
Navin2-Aug-02 4:53
Navin2-Aug-02 4:53 
AnswerRe: How to force a thread to end?? Pin
Joao Vaz2-Aug-02 5:19
Joao Vaz2-Aug-02 5:19 
QuestionQueryStatus of IOleCommandTarget implemented... errors? Pin
Tommy Svensson2-Aug-02 0:25
Tommy Svensson2-Aug-02 0:25 
Generalusing assembly in turbo c++, help Pin
asif m@hmood1-Aug-02 23:42
asif m@hmood1-Aug-02 23:42 
GeneralRe: using assembly in turbo c++, help Pin
PJ Arends2-Aug-02 8:01
professionalPJ Arends2-Aug-02 8:01 
GeneralRe: using assembly in turbo c++, help Pin
asifmahmood2-Aug-02 8:24
asifmahmood2-Aug-02 8:24 
GeneralRe: using assembly in turbo c++, help Pin
PJ Arends2-Aug-02 10:06
professionalPJ Arends2-Aug-02 10:06 
GeneralRe: GOTOXY Pin
RaCeRx30-Oct-02 19:36
RaCeRx30-Oct-02 19:36 
GeneralDate serial <-> day month year Pin
Victor Vogelpoel1-Aug-02 23:31
Victor Vogelpoel1-Aug-02 23:31 
GeneralRe: Date serial <-> day month year Pin
[James Pullicino]1-Aug-02 23:37
[James Pullicino]1-Aug-02 23:37 
GeneralRe: Date serial <-> day month year Pin
Victor Vogelpoel3-Aug-02 7:01
Victor Vogelpoel3-Aug-02 7:01 
Generalchange the tab font of a property sheet from the same tab. Pin
Joan M1-Aug-02 23:14
professionalJoan M1-Aug-02 23:14 
GeneralRe: change the tab font of a property sheet from the same tab. Pin
Tomasz Sowinski1-Aug-02 23:51
Tomasz Sowinski1-Aug-02 23:51 
GeneralCRichEditCtrl MFC Pin
Anonymous1-Aug-02 22:55
Anonymous1-Aug-02 22:55 
GeneralRe: CRichEditCtrl MFC Pin
[James Pullicino]1-Aug-02 23:38
[James Pullicino]1-Aug-02 23:38 
GeneralRe: CRichEditCtrl MFC Pin
Olli2-Aug-02 1:16
Olli2-Aug-02 1:16 

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.