Click here to Skip to main content
15,887,585 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTerminating Threads! [modified] Pin
Caslen16-Sep-10 3:21
Caslen16-Sep-10 3:21 
AnswerRe: Terminating Threads! Pin
Cool_Dev16-Sep-10 5:26
Cool_Dev16-Sep-10 5:26 
GeneralRe: Terminating Threads! Pin
Roger Allen16-Sep-10 5:50
Roger Allen16-Sep-10 5:50 
GeneralRe: Terminating Threads! Pin
Luc Pattyn16-Sep-10 6:14
sitebuilderLuc Pattyn16-Sep-10 6:14 
GeneralRe: Terminating Threads! Pin
Caslen16-Sep-10 5:59
Caslen16-Sep-10 5:59 
GeneralRe: Terminating Threads! Pin
Chris Losinger16-Sep-10 6:02
professionalChris Losinger16-Sep-10 6:02 
GeneralRe: Terminating Threads! Pin
Caslen16-Sep-10 6:08
Caslen16-Sep-10 6:08 
AnswerRe: Terminating Threads! Pin
David Crow16-Sep-10 5:53
David Crow16-Sep-10 5:53 
Caslen wrote:
::SendMessage(m_ControlsDialog,WM_CLOSE,0,0); //send a message to close the dialog and thread


You've not shown how m_ControlsDialog was declared. I assume it's safe to send a message to. If it's a modeless dialog, why not just call DestroyWindow()?

Caslen wrote:
while(self->m_TerminateThreads!=0)


This loop is suspect if m_TerminateThreads is not declared as volatile. Otherwise, it may or may not execute, or it may fail to end. Because m_TerminateThreads is not being changed within the loop, the compiler would likely optimize it out.

A better way of having the secondary thread end is to have the primary thread signal an event.

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"Man who follows car will be exhausted." - Confucius


GeneralRe: Terminating Threads! Pin
Caslen16-Sep-10 6:04
Caslen16-Sep-10 6:04 
GeneralRe: Terminating Threads! Pin
David Crow16-Sep-10 6:45
David Crow16-Sep-10 6:45 
GeneralRe: Terminating Threads! Pin
Caslen16-Sep-10 22:31
Caslen16-Sep-10 22:31 
QuestionRe: Terminating Threads! Pin
David Crow17-Sep-10 2:56
David Crow17-Sep-10 2:56 
AnswerRe: Terminating Threads! Pin
Caslen17-Sep-10 3:04
Caslen17-Sep-10 3:04 
GeneralRe: Terminating Threads! Pin
David Crow17-Sep-10 3:09
David Crow17-Sep-10 3:09 
AnswerRe: Terminating Threads! Pin
Roger Allen16-Sep-10 5:54
Roger Allen16-Sep-10 5:54 
QuestionLine Drawing Pin
Benjamin Bruno16-Sep-10 1:17
Benjamin Bruno16-Sep-10 1:17 
AnswerRe: Line Drawing Pin
Shivanand Gupta16-Sep-10 1:28
Shivanand Gupta16-Sep-10 1:28 
QuestionRe: Line Drawing Pin
David Crow16-Sep-10 5:45
David Crow16-Sep-10 5:45 
AnswerRe: Line Drawing Pin
Cool_Dev16-Sep-10 4:56
Cool_Dev16-Sep-10 4:56 
QuestionTree Ctrl Pin
VVVimal16-Sep-10 0:18
VVVimal16-Sep-10 0:18 
AnswerRe: Tree Ctrl Pin
Niklas L16-Sep-10 1:09
Niklas L16-Sep-10 1:09 
QuestionStandard Object and Function names helper Pin
Chesnokov Yuriy15-Sep-10 22:59
professionalChesnokov Yuriy15-Sep-10 22:59 
AnswerRe: Standard Object and Function names helper Pin
Aescleal16-Sep-10 0:07
Aescleal16-Sep-10 0:07 
GeneralRe: Standard Object and Function names helper Pin
Chesnokov Yuriy16-Sep-10 0:20
professionalChesnokov Yuriy16-Sep-10 0:20 
GeneralRe: Standard Object and Function names helper Pin
Aescleal16-Sep-10 1:35
Aescleal16-Sep-10 1:35 

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.