Click here to Skip to main content
15,918,109 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: PeekMessage and DoEvents Pin
Rozis19-Jan-10 2:17
Rozis19-Jan-10 2:17 
GeneralRe: PeekMessage and DoEvents Pin
CPallini18-Jan-10 20:58
mveCPallini18-Jan-10 20:58 
Questionwin32 dialog Pin
john563218-Jan-10 1:58
john563218-Jan-10 1:58 
AnswerRe: win32 dialog Pin
Abhi Lahare18-Jan-10 6:16
Abhi Lahare18-Jan-10 6:16 
QuestionThreading Pin
HakunaMatada18-Jan-10 1:48
HakunaMatada18-Jan-10 1:48 
AnswerRe: Threading Pin
Cedric Moonen18-Jan-10 2:08
Cedric Moonen18-Jan-10 2:08 
GeneralRe: Threading Pin
HakunaMatada18-Jan-10 2:11
HakunaMatada18-Jan-10 2:11 
AnswerRe: Threading Pin
Moak18-Jan-10 3:34
Moak18-Jan-10 3:34 
GeneralRe: Threading Pin
HakunaMatada19-Jan-10 1:26
HakunaMatada19-Jan-10 1:26 
QuestionClose A DIalog Pin
john563218-Jan-10 0:58
john563218-Jan-10 0:58 
AnswerRe: Close A DIalog Pin
Code-o-mat18-Jan-10 1:25
Code-o-mat18-Jan-10 1:25 
GeneralRe: Close A DIalog Pin
john563218-Jan-10 1:29
john563218-Jan-10 1:29 
QuestionThread paused Pin
susanne117-Jan-10 23:56
susanne117-Jan-10 23:56 
QuestionRe: Thread paused Pin
CPallini18-Jan-10 0:16
mveCPallini18-Jan-10 0:16 
AnswerRe: Thread paused Pin
susanne118-Jan-10 0:50
susanne118-Jan-10 0:50 
GeneralRe: Thread paused Pin
CPallini18-Jan-10 0:58
mveCPallini18-Jan-10 0:58 
AnswerRe: Thread paused Pin
Covean18-Jan-10 0:59
Covean18-Jan-10 0:59 
QuestionRe: Thread paused Pin
CPallini18-Jan-10 1:39
mveCPallini18-Jan-10 1:39 
AnswerRe: Thread paused Pin
Covean18-Jan-10 1:57
Covean18-Jan-10 1:57 
AnswerRe: Thread paused Pin
xushih19-Jan-10 1:38
xushih19-Jan-10 1:38 
QuestionRe: Thread paused Pin
CPallini19-Jan-10 1:54
mveCPallini19-Jan-10 1:54 
AnswerRe: Thread paused Pin
Adam Roderick J18-Jan-10 0:18
Adam Roderick J18-Jan-10 0:18 
QuestionRe: Thread paused Pin
Covean18-Jan-10 1:02
Covean18-Jan-10 1:02 
GeneralRe: Thread paused Pin
susanne118-Jan-10 1:16
susanne118-Jan-10 1:16 
GeneralRe: Thread paused Pin
Covean18-Jan-10 1:49
Covean18-Jan-10 1:49 
I couldn't find any reason why your thread pauses for 3-5 seconds.
But your "main loop" is a kind of resource-eating.
Do you really meant to use a timeout of 0 to wait for this object?
0 timeout means to check the signaled state of the waitable handle
and to return immediately. So your loop will iterate very very fast and
consumes nearly 100% processing time.

UINT CMyThread::ThreadFunction(LPVOID param)
{
    while(!bTerminate) // bool bTerminate 
    {
        if ((::WaitForSingleObject(m_Sel_End_Event, 0) == WAIT_OBJECT_0))
        {
            bTerminate = true; 
            continue;
        } 
    }
}


But as I said before this doesn't solve your problem. Is there maybe more code you can provide?
By the way you also use the 0 timeout also in your ThreadStart function (but there it shouldn't be
a problem).

Greetings
Covean

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.