Dan|]
September 22nd, 2005, 07:00 AM
Hello,
Just a(naive) question - or two - about resuming a thread, created suspended.
1. Let's say that we have a class:
"
//MyThreads header
...
class MyThread :: public CWinThread {
...
BOOL InitInstance();
Procedure();
...
HANDLE m_hEventKill;/* in the contructor is initialized m_hEventKill = CreateEvent(NULL, TRUE, FALSE, NULL);*/
};
//MyThread implementation
BOOL MyThread::InitInstance()
{
...//init stuff
while (WaitForSingleObject(m_hEventKill, 0) == WAIT_TIMEOUT)
Procedure();
return FALSE;
};
"
The question is as follows: if the m_hEventKill HANDLE signals the thread to exit instance at a certain phase in the Procedure(), when it is resumed it shall actually start from the very phase it exited ?
2. If yes, is there possible to serialize the thread to be thus resumed ?
Thank you,
Just a(naive) question - or two - about resuming a thread, created suspended.
1. Let's say that we have a class:
"
//MyThreads header
...
class MyThread :: public CWinThread {
...
BOOL InitInstance();
Procedure();
...
HANDLE m_hEventKill;/* in the contructor is initialized m_hEventKill = CreateEvent(NULL, TRUE, FALSE, NULL);*/
};
//MyThread implementation
BOOL MyThread::InitInstance()
{
...//init stuff
while (WaitForSingleObject(m_hEventKill, 0) == WAIT_TIMEOUT)
Procedure();
return FALSE;
};
"
The question is as follows: if the m_hEventKill HANDLE signals the thread to exit instance at a certain phase in the Procedure(), when it is resumed it shall actually start from the very phase it exited ?
2. If yes, is there possible to serialize the thread to be thus resumed ?
Thank you,