Operator Console
|
Thread synchronization and communication class. More...
#include <ThreadControl.h>
Public Member Functions | |
ThreadControl () | |
virtual | ~ThreadControl (void) |
bool | Init (UINT threadMsg, DWORD parentID, AFX_THREADPROC threadProc, void *data) |
void | Quit () |
void | Run () |
ThreadControl () | |
virtual | ~ThreadControl (void) |
bool | Init (UINT threadMsg, DWORD parentID, AFX_THREADPROC threadProc, void *data) |
void | Quit () |
void | Run () |
Public Attributes | |
CWinThread * | m_thread |
the thread that we want to control More... | |
CEvent * | m_runEvent |
when this event is received, run the child's function once More... | |
CEvent * | m_doneEvent |
when this event is received, terminate the thread More... | |
HANDLE | m_events [2] |
UINT | m_threadMsg |
message to send to parent thread More... | |
DWORD | m_parentID |
the thread to send the message to More... | |
void * | m_data |
pointer to whatever is useful More... | |
Protected Member Functions | |
void | InitEvents () |
bool | InitThread (AFX_THREADPROC threadProc) |
void | InitEvents () |
bool | InitThread (AFX_THREADPROC threadProc) |
Thread synchronization and communication class.
This class simplifies the task of having 2 threads communicate with each other.
Thread control is done using CEvent objects, by calling WaitForMultipleObjects(). The child thread will block until it receives either of 2 objects: RUN_OBJECT tells the thread to run its function, and send a message to its parent thread DONE_OBJECT tells the thread to quit
A pointer to a ThreadControl object should be passed as the thread function's single parameter
ThreadControl::ThreadControl | ( | ) |
References DONE_INDEX, m_data, m_doneEvent, m_events, m_runEvent, m_thread, and RUN_INDEX.
|
virtual |
References m_doneEvent, m_runEvent, and m_thread.
ThreadControl::ThreadControl | ( | ) |
|
virtual |
bool ThreadControl::Init | ( | UINT | threadMsg, |
DWORD | parentID, | ||
AFX_THREADPROC | threadProc, | ||
void * | data | ||
) |
References InitThread(), m_data, m_parentID, and m_threadMsg.
Referenced by COperatorConsoleApp::InitBlemishThread(), COperatorConsoleApp::InitCameraThread(), and COperatorConsoleApp::InitSFRplusThread().
bool ThreadControl::Init | ( | UINT | threadMsg, |
DWORD | parentID, | ||
AFX_THREADPROC | threadProc, | ||
void * | data | ||
) |
|
protected |
|
protected |
|
protected |
|
protected |
void ThreadControl::Quit | ( | ) |
void ThreadControl::Quit | ( | ) |
References m_doneEvent, and m_thread.
Referenced by COperatorConsoleApp::Quit(), and COperatorConsoleApp::ReInit().
void ThreadControl::Run | ( | ) |
References m_runEvent.
Referenced by COperatorConsoleApp::OnFrameReady(), and COperatorConsoleApp::OnRunTest().
void ThreadControl::Run | ( | ) |
void * ThreadControl::m_data |
pointer to whatever is useful
Referenced by COperatorConsoleApp::GetTestName(), Init(), ThreadControl(), ImageAcquisition::ThreadProc(), and ImageTest::ThreadProc().
CEvent * ThreadControl::m_doneEvent |
when this event is received, terminate the thread
Referenced by Quit(), ThreadControl(), and ~ThreadControl().
HANDLE ThreadControl::m_events |
Referenced by ThreadControl(), ImageAcquisition::ThreadProc(), and ImageTest::ThreadProc().
DWORD ThreadControl::m_parentID |
the thread to send the message to
Referenced by Init(), ImageAcquisition::ThreadProc(), and ImageTest::ThreadProc().
CEvent * ThreadControl::m_runEvent |
when this event is received, run the child's function once
Referenced by Run(), ThreadControl(), and ~ThreadControl().
CWinThread * ThreadControl::m_thread |
the thread that we want to control
Referenced by InitThread(), Quit(), ThreadControl(), and ~ThreadControl().
UINT ThreadControl::m_threadMsg |
message to send to parent thread
Referenced by Init(), ImageAcquisition::ThreadProc(), and ImageTest::ThreadProc().