Click here to Skip to main content
16,008,490 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Put PC into sleep mode Pin
Mike Nordell13-Jun-02 3:12
Mike Nordell13-Jun-02 3:12 
GeneralCheck list control Pin
Rula Ghabbiesh12-Jun-02 21:09
Rula Ghabbiesh12-Jun-02 21:09 
GeneralRe: Check list control Pin
Renjith Ramachandran12-Jun-02 23:04
Renjith Ramachandran12-Jun-02 23:04 
GeneralSocket Read/Write Pin
unknown soldier12-Jun-02 20:49
unknown soldier12-Jun-02 20:49 
GeneralRe: Socket Read/Write Pin
Nish Nishant12-Jun-02 21:19
sitebuilderNish Nishant12-Jun-02 21:19 
QuestionInterrupts? Pin
wilche12-Jun-02 20:44
wilche12-Jun-02 20:44 
AnswerRe: Interrupts? Pin
Renjith Ramachandran12-Jun-02 22:49
Renjith Ramachandran12-Jun-02 22:49 
GeneralRe: Interrupts? Pin
wilche13-Jun-02 13:16
wilche13-Jun-02 13:16 
Thanks for your reply. Not disputing what you said but I have some questions....

If I used worker thread, for example the following code:

//ThreadProc is the procedure used by worker thread
int ThreadProc()
{
// event declarations and def
event[0] = ::CreateEvent(NULL, TRUE, FALSE, NULL) // Stop/abort
event[1] = ::CreateEvent(NULL, TRUE, FALSE, NULL) // Run

DWORD status;
while(TRUE)
{
status = WaitForMultipleObjects(2, event, FALSE, infinite);
switch(status)
{
case WAIT_OBJECT_0: // Abort
CloseHandle(ThreadId);
return result;

case WAIT_OBJECT_0+1:
result = RunFunction();
break;
}
}

return result;
}

In this case, wouldn't it still wait for RunFunction to finish before processing the Abort Event?

If I create an UI thread using message queue, I do something similar using GetMessage say.

int ThreadProc()
{
DWORD status;
while(TRUE)
{
status = GetMessage(&msg, NULL, 0, 0);

// Check that the message is valid...code ignored here. Assume it's ok
switch(msg.message)
{
case abort: // Abort
CloseHandle(ThreadId);
return result;

case run:
result = RunFunction();
break;
}
}

return result;
}

Would I still have the same problem? In this case, RunFunction will have to be completed before the next message will be processed.


Kind regards,
wilche
GeneralCreate a thread & use mutex for synchronization Pin
Rsh12-Jun-02 19:14
Rsh12-Jun-02 19:14 
GeneralRe: Create a thread & use mutex for synchronization Pin
Michael Dunn12-Jun-02 20:12
sitebuilderMichael Dunn12-Jun-02 20:12 
GeneralRe: Create a thread & use mutex for synchronization Pin
wilche12-Jun-02 20:30
wilche12-Jun-02 20:30 
GeneralRe: Create a thread & use mutex for synchronization Pin
paulb12-Jun-02 21:08
paulb12-Jun-02 21:08 
GeneralRe: Create a thread & use mutex for synchronization Pin
Tim Smith13-Jun-02 1:47
Tim Smith13-Jun-02 1:47 
GeneralDeleting files from floppy Pin
Sameer Maggon12-Jun-02 18:29
Sameer Maggon12-Jun-02 18:29 
GeneralRe: Deleting files from floppy Pin
Nish Nishant12-Jun-02 18:40
sitebuilderNish Nishant12-Jun-02 18:40 
GeneralRe: Deleting files from floppy Pin
Mike Nordell13-Jun-02 3:16
Mike Nordell13-Jun-02 3:16 
GeneralShared Memory Doubt!!! Pin
BK Pradeep12-Jun-02 17:58
BK Pradeep12-Jun-02 17:58 
GeneralConvert .x file to 3ds file format Pin
nachilau12-Jun-02 17:16
nachilau12-Jun-02 17:16 
GeneralFocus & Always-On-Top :: MFC Pin
valikac12-Jun-02 14:41
valikac12-Jun-02 14:41 
GeneralRe: Focus & Always-On-Top :: MFC Pin
Christian Graus12-Jun-02 14:43
protectorChristian Graus12-Jun-02 14:43 
GeneralRe: Focus & Always-On-Top :: MFC Pin
valikac12-Jun-02 15:02
valikac12-Jun-02 15:02 
GeneralRe: Focus & Always-On-Top :: MFC Pin
valikac12-Jun-02 16:20
valikac12-Jun-02 16:20 
GeneralRe: Focus & Always-On-Top :: MFC Pin
valikac12-Jun-02 16:29
valikac12-Jun-02 16:29 
GeneralRe: Focus & Always-On-Top :: MFC Pin
Cris8-Nov-02 0:37
Cris8-Nov-02 0:37 
Generalcfile question Pin
jafrazee12-Jun-02 14:30
jafrazee12-Jun-02 14:30 

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.