Important:
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.
A version of this page is also available for
4/8/2010

This is an abstract class, a worker thread class that provides creation, synchronization, and communication with a worker thread. The worker thread can be accessed from several client threads. The class provides member functions to create the thread, pass commands to it, and wait for it to exit.

Use a CCritSecobject to ensure that only one thread can make a request at a time.

Use two CAMEventobjects: one to signal to the worker that a request is outstanding, and the other to signal to the client thread that the request has been completed.

A nonblocking CAMThread::CheckRequestmember function allows the worker thread to check for new requests while working asynchronously.

Derive from this class to provide your own thread member function. You might also want to provide type-safe signaling member functions that package parameters and return values using the CAMThread::CallWorkermember function.

Thread creation is independent of object creation. Create a member variable derived from CAMThread, and then use the member functions to start and stop the thread when needed.

Data Members

Member Description

m_AccessLock

Critical section object that locks access by client threads.

m_WorkerLock

Critical section object that locks access to shared objects.

Member Functions

Member function Description

CallWorker

Makes a request to the worker thread.

CAMThread

Constructs a CAMThreadobject.

CheckRequest

Determines if there is an outstanding request. This is a nonblocking member function.

Close

Blocks until the thread has exited and released its resources.

Create

Starts the thread running.

GetRequest

Blocks until the next request is made and then returns a DWORDvalue.

GetRequestHandle

Retrieves an event handle.

GetRequestParam

Retrieves the latest request.

InitialThreadProc

Retrieves a thispointer.

Carry out this member function before calling the CAMThread::ThreadProcmember function.

Reply

Retrieves a DWORDvalue to the requesting thread and releases it, signaling completion of the request.

ThreadExists

Determines whether a thread exists or has exited.

ThreadProc

Indicates a pure virtual member function that is called on the worker thread.

Requirements

Windows Embedded CE Windows CE 2.12 and later
Windows Mobile Windows Mobile Version 5.0 and later
Note Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements
For more information, see Setting Up the Build Environment