WorkItem Class Reference

Abstraction of a piece of work to be done by WorkerThread Inherit this class to define concrete work items. More...

#include <thread.h>

Inherited by FetchResourceListWorkItem, and ResourceInfoWorkItem.

Collaboration diagram for WorkItem:
Collaboration graph
[legend]

Public Member Functions

 WorkItem ()
 Construct a new WorkItem.
virtual ~WorkItem ()
 Destructor.
virtual void Run ()=0
 Implement this in derived class to do the work.
bool Cancel ()
 Cancel this WorkItem, remove it from queue.
int GetPriority () const

Private Attributes

int m_priority
 Priority of item, highest is run first.
volatile bool m_toBeDeleted
 Should this item be deleted after it has run?
WorkItemQueuem_queue

Friends

class WorkItemQueue
class WorkerThread

Detailed Description

Abstraction of a piece of work to be done by WorkerThread Inherit this class to define concrete work items.

Definition at line 69 of file thread.h.


Constructor & Destructor Documentation

WorkItem::WorkItem (  )  [inline]

Construct a new WorkItem.

Definition at line 74 of file thread.h.

virtual WorkItem::~WorkItem (  )  [inline, virtual]

Destructor.

Definition at line 77 of file thread.h.


Member Function Documentation

bool WorkItem::Cancel (  ) 

Cancel this WorkItem, remove it from queue.

Returns:
true if it was removed, false otherwise

Definition at line 122 of file thread.cpp.

int WorkItem::GetPriority (  )  const [inline]

Definition at line 86 of file thread.h.

virtual void WorkItem::Run (  )  [pure virtual]

Implement this in derived class to do the work.

Implemented in ResourceInfoWorkItem, and FetchResourceListWorkItem.


Friends And Related Function Documentation

friend class WorkerThread [friend]

Definition at line 94 of file thread.h.

friend class WorkItemQueue [friend]

Definition at line 93 of file thread.h.


Field Documentation

int WorkItem::m_priority [private]

Priority of item, highest is run first.

Definition at line 89 of file thread.h.

Definition at line 91 of file thread.h.

volatile bool WorkItem::m_toBeDeleted [private]

Should this item be deleted after it has run?

Definition at line 90 of file thread.h.


The documentation for this class was generated from the following files:

Generated on Thu Dec 29 00:11:50 2011 for SpringLobby by doxygen 1.6.3