The CMsgThread class provides support for a worker thread to which requests can be posted asynchronously instead of sent directly. The CAMThread class provides a worker thread to which single requests can be sent. Only one client can make a request at a time, and the client blocks until the worker thread has completed the request. By contrast, the CMsgThread class provides a worker thread to which any number of requests can be posted. The requests (in the form of a CMsg object) are queued and executed in order, asynchronously. No reply or return value is received.
dwFlags Flag parameter to the request code. lpParam Data required by the worker thread as parameter or return values. This data should not be stack-based, as it will be referenced some time after completing the queuing operation. pEvent Event object that a worker thread can signal to indicate the completion of the operation. uMsg Request code that is defined by the client of the thread class and understood by the overridden worker thread function.
Member Functions
CMsg Constructs a CMsg object.
Constructs a CMsg object.
Syntax
CMsg(
UINT u,
DWORD dw,
LPVOID lp,
CAMEvent *pEvent
);
Parameters
- u
- Request code, defined by the client of the thread class and understood by the overridden worker thread function.
- dw
- Flag parameter to the request code.
- lp
- Pointer to data required by the worker thread as parameter or return values. This data should not be stack-based, as it will be referenced some time after completing the queuing operation.
- pEvent
- Pointer to the event object that a worker thread can signal to indicate the completion of the operation.
Return Value
No return value.
Remarks
This member function contains a request for a CMsgThread worker thread to act on. All the parameters are passed to the worker thread function as parameters when this message gets processed. The meanings of the parameters are defined by the client function that calls the worker thread and the derived class that supplies the worker thread's execution function.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.