Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

CWorkQueue Class Reference

#include <WorkQueue.h>


Public Member Functions

 CWorkQueue (CSyncObject *pextEvent)
bool AddItem (CWorkQueueItem *pFileAttr, bool uniqueItem=true)
bool DelItem (CWorkQueueItem *pFileAttr)
bool CheckItem (CWorkQueueItem *pFileAttr, bool ProcessOnly=false)
CWorkQueueItemGetProcItem (void)
 Returns the currently being processed object's pointer.


Private Member Functions

bool WorkerThread (void)

Static Private Member Functions

UINT WorkerThreadStart (CWorkQueue *pQueue)
 Bootstrapping function for AfxBeginThread.


Private Attributes

CEvent m_WorkEvent
 Wakes up the worker thread when new objects need processing.

CMutex m_WorkQueueMutex
 Keep pesky threads from trampling the queue.

CSyncObject * m_pThreadEvents [2]
 Array for the worker thread's wake-up events.

CWinThread * m_pWorkerThread
 Safe-keeping the worker thread's pointer, just in case. Also used by the destructor to detect thread exit.

bool m_PendDelete
 Set by the destructor while waiting for the worker thread to exit.

CWorkQueueItemm_WorkItem
 Holds the pointer to the currently being processed object.

CTypedPtrList< CPtrList, CWorkQueueItem * > m_WorkQueue
 Contains a list of items to process.


Constructor & Destructor Documentation

CWorkQueue::CWorkQueue CSyncObject *  pextEvent  ) 
 

Initializes the queue and thread data then starts the Work Queue's thread.

Parameters:
pextEvent Pointer to an external CSyncObject used to wake up the thread, should usually be the shutdown event.


Member Function Documentation

bool CWorkQueue::AddItem CWorkQueueItem pWork,
bool  uniqueItem = true
 

Adds an item to the processing list.

Parameters:
pWork Workload to add
uniqueItem Only allow one item to be in the queue at a time when true.
Returns:
True the item was added to the list.

bool CWorkQueue::CheckItem CWorkQueueItem pWork,
bool  ProcessOnly = false
 

Check if the item is in the processing list.

Parameters:
pWork Workload to check up on
ProcessOnly Only check if the specified item is being processed
Returns:
True if the item is in the list or being processed

bool CWorkQueue::DelItem CWorkQueueItem pWork  ) 
 

Removes an item from the processing list.

Parameters:
pWork Workload to remove
Returns:
True the item was found and removed from the list.

bool CWorkQueue::WorkerThread void   )  [private]
 

Processes queued tasks.

Returns:
Always true - unless some reason for it doing otherwise come up.


The documentation for this class was generated from the following files:
Generated on Wed Nov 5 05:48:09 2003 for Moonlight's eMule Tweaks Documentation by doxygen 1.3.4