Microsoft Windows CE 3.0  

CMsgThread Class

This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This class is a worker thread class that queues requests to the queuing thread for completion asynchronously. To use this class, derive your class from it and override the CMsgThread::ThreadMessageProcmember function. The ThreadMessageProcmember function carries out each request. Your client functions and the ThreadMessageProcmember function must share a common definition of the parameters in the CMsgobject.

A negotiated mechanism tells the worker thread to exit. Typically, this will be one value of the CMsgclass's uMsgmessage code.

It is a good idea to send this message from the destructor of your derived class, and call the CMsgThread::WaitForThreadExitmember function before completing the destruction of the derived class.

Protected Data Members

m_hSem Indicates a handle used for signaling.
m_Lock Protects access to lists.
m_lWaiting Indicates waiting for a free thread.
m_ThreadQueue Overrides the CMsgThread::GetThreadMsgmember function and blocks on things other than this queue.

Member Functions

CMsgThread Constructs a CMsgThreadobject.
CreateThread Creates a thread.
GetThreadHandle Returns the thread handle.
GetThreadID Returns the identifier of the thread.
GetThreadPriority Retrieves the current thread priority.
PutThreadMsg Queues a request for execution by the worker thread.
ResumeThread Continues the operation of the worker thread.
SetThreadPriority Sets the priority of the thread to a new value.
SuspendThread Suspends the operation of a running thread.
WaitForThreadExit Blocks until the thread has exited after a call to the CMsgThread::SuspendThreadmember function.

Overridable Member Functions

GetThreadMsg Retrieves a queued CMsgobject containing a request.
OnThreadInit Provides initialization on a thread.
ThreadMessageProc Processes requests. This is a pure virtual member function.