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

C / C++ / MFC

 
GeneralOne more problem with buttons. Pin
scanf24-Feb-05 20:05
scanf24-Feb-05 20:05 
GeneralRe: One more problem with buttons. Pin
Branislav25-Feb-05 1:03
Branislav25-Feb-05 1:03 
GeneralRe: One more problem with buttons. Pin
Ravi Bhavnani25-Feb-05 3:42
professionalRavi Bhavnani25-Feb-05 3:42 
QuestionHow to invork iexplorer.exe Pin
mrfine24-Feb-05 19:13
mrfine24-Feb-05 19:13 
AnswerRe: How to invork iexplorer.exe Pin
Yulianto.24-Feb-05 19:58
Yulianto.24-Feb-05 19:58 
GeneralRe: How to invork iexplorer.exe Pin
mrfine24-Feb-05 20:00
mrfine24-Feb-05 20:00 
AnswerRe: How to invork iexplorer.exe Pin
ThatsAlok24-Feb-05 20:00
ThatsAlok24-Feb-05 20:00 
GeneralExiting a Thread Nicely Pin
LighthouseJ24-Feb-05 17:44
LighthouseJ24-Feb-05 17:44 
I'm having some trouble making a thread I have exit nicely. The thread function looks like:
UINT tBeginCommunication (LPVOID pParam) {<br />
t_commPackage * commPackage = (t_commPackage*) pParam;<br />
while (commPackage->cmdStopThread) {<br />
... do thread work here ...<br />
}<br />
commPackage->haveStoppedThread = true;<br />
AfxEndThread(0, false);<br />
return 0;<br />
}


When I want to stop the thread, I have this:
m_serialPortData->cmdStopThread = true;<br />
while (!(m_serialPortData->haveStoppedThread));

It signals to stop the thread, and waits until the thread has stopped.

The problem is that the while loop in the controlling function is never exited, it hammers the CPU and therefore the OS, I need to end the process via Task Manager to get back control. The data is not deleted because of the false argument in the AfxEndThread call so the main function has a chance to read it in the while.

I know I must be missing some thread nuance everyone else knows so please let me know what I'm not doing right. Thanks in advance, Nate.
GeneralRe: Exiting a Thread Nicely Pin
S. Senthil Kumar24-Feb-05 18:12
S. Senthil Kumar24-Feb-05 18:12 
GeneralRe: Exiting a Thread Nicely Pin
David Crow25-Feb-05 2:58
David Crow25-Feb-05 2:58 
GeneralRe: Exiting a Thread Nicely Pin
LighthouseJ25-Feb-05 7:59
LighthouseJ25-Feb-05 7:59 
Generalmonitoring TCP/UDP ports Pin
Imtiaz Murtaza24-Feb-05 17:21
Imtiaz Murtaza24-Feb-05 17:21 
Questionhow to load an image in mainframe window's client area Pin
Cool Ju24-Feb-05 17:19
Cool Ju24-Feb-05 17:19 
AnswerRe: how to load an image in mainframe window's client area Pin
PJ Arends24-Feb-05 17:25
professionalPJ Arends24-Feb-05 17:25 
GeneralRe: how to load an image in mainframe window's client area Pin
Cool Ju24-Feb-05 17:48
Cool Ju24-Feb-05 17:48 
QuestionSaving the all the contents on the CFormView to .jpg or .bmp file? Pin
ledallam24-Feb-05 16:57
ledallam24-Feb-05 16:57 
AnswerRe: Saving the all the contents on the CFormView to .jpg or .bmp file? Pin
PJ Arends24-Feb-05 17:21
professionalPJ Arends24-Feb-05 17:21 
GeneralRe: Saving the all the contents on the CFormView to .jpg or .bmp file? Pin
ledallam24-Feb-05 17:42
ledallam24-Feb-05 17:42 
GeneralRe: Saving the all the contents on the CFormView to .jpg or .bmp file? Pin
ledallam24-Feb-05 17:47
ledallam24-Feb-05 17:47 
GeneralRe: Saving the all the contents on the CFormView to .jpg or .bmp file? Pin
PJ Arends24-Feb-05 21:25
professionalPJ Arends24-Feb-05 21:25 
Generalwhere can I get the file &quot;pvm3.h&quot; Pin
SarahDong24-Feb-05 16:38
sussSarahDong24-Feb-05 16:38 
GeneralRe: where can I get the file &quot;pvm3.h&quot; Pin
Christian Graus24-Feb-05 17:29
protectorChristian Graus24-Feb-05 17:29 
GeneralRe: where can I get the file &quot;pvm3.h&quot; Pin
Aamir Butt25-Feb-05 0:18
Aamir Butt25-Feb-05 0:18 
GeneralRe: where can I get the file &quot;pvm3.h&quot; Pin
Rick York24-Feb-05 18:46
mveRick York24-Feb-05 18:46 
GeneralRe: where can I get the file &quot;pvm3.h&quot; Pin
Ravi Bhavnani25-Feb-05 3:45
professionalRavi Bhavnani25-Feb-05 3:45 

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.