LLWorkerClass Class Reference

#include <llworkerthread.h>

Inheritance diagram for LLWorkerClass:

Inheritance graph
[legend]
Collaboration diagram for LLWorkerClass:

Collaboration graph
[legend]
List of all members.

Public Types

typedef LLWorkerThread::handle_t handle_t
 WCF_HAVE_WORK = 0x01
 WCF_WORKING = 0x02
 WCF_WORK_FINISHED = 0x10
 WCF_WORK_ABORTED = 0x20
 WCF_DELETE_REQUESTED = 0x40
 WCF_ABORT_REQUESTED = 0x80
enum  FLAGS {
  WCF_HAVE_WORK = 0x01, WCF_WORKING = 0x02, WCF_WORK_FINISHED = 0x10, WCF_WORK_ABORTED = 0x20,
  WCF_DELETE_REQUESTED = 0x40, WCF_ABORT_REQUESTED = 0x80
}

Public Member Functions

 LLWorkerClass (LLWorkerThread *workerthread, const std::string &name)
virtual ~LLWorkerClass ()
virtual bool doWork (S32 param)=0
virtual void finishWork (S32 param, bool completed)
virtual bool deleteOK ()
void scheduleDelete ()
bool haveWork ()
bool isWorking ()
bool wasAborted ()
void setPriority (U32 priority)
U32 getPriority ()
const std::string & getName () const

Protected Member Functions

void setWorking (bool working)
bool yield ()
void setWorkerThread (LLWorkerThread *workerthread)
void addWork (S32 param, U32 priority=LLWorkerThread::PRIORITY_NORMAL)
void abortWork (bool autocomplete)
bool checkWork (bool aborting=false)

Protected Attributes

LLWorkerThreadmWorkerThread
std::string mWorkerClassName
handle_t mRequestHandle
U32 mRequestPriority

Private Member Functions

void setFlags (U32 flags)
void clearFlags (U32 flags)
U32 getFlags ()
bool getFlags (U32 flags)
virtual void startWork (S32 param)=0
virtual void endWork (S32 param, bool aborted)=0

Private Attributes

LLMutex mMutex
LLAtomicU32 mWorkFlags

Friends

class LLWorkerThread
class LLWorkerThread::WorkRequest

Detailed Description

Definition at line 117 of file llworkerthread.h.


Member Typedef Documentation

typedef LLWorkerThread::handle_t LLWorkerClass::handle_t

Definition at line 122 of file llworkerthread.h.


Member Enumeration Documentation

enum LLWorkerClass::FLAGS

Enumerator:
WCF_HAVE_WORK 
WCF_WORKING 
WCF_WORK_FINISHED 
WCF_WORK_ABORTED 
WCF_DELETE_REQUESTED 
WCF_ABORT_REQUESTED 

Definition at line 123 of file llworkerthread.h.


Constructor & Destructor Documentation

LLWorkerClass::LLWorkerClass ( LLWorkerThread workerthread,
const std::string &  name 
)

Definition at line 183 of file llworkerthread.cpp.

References llendl, llerrs, and mWorkerThread.

LLWorkerClass::~LLWorkerClass (  )  [virtual]

Definition at line 196 of file llworkerthread.cpp.

References LLQueuedThread::getRequest(), LLQueuedThread::QueuedRequest::getStatus(), llassert_always, llendl, llerrs, mRequestHandle, mWorkerThread, mWorkFlags, LLQueuedThread::nullHandle(), LLQueuedThread::STATUS_ABORTED, LLQueuedThread::STATUS_COMPLETE, WCF_DELETE_REQUESTED, and WCF_WORKING.


Member Function Documentation

void LLWorkerClass::abortWork ( bool  autocomplete  )  [protected]

Definition at line 292 of file llworkerthread.cpp.

References LLQueuedThread::abortRequest(), LLMutex::lock(), mMutex, mRequestHandle, mWorkerThread, LLQueuedThread::nullHandle(), LLQueuedThread::PRIORITY_IMMEDIATE, setFlags(), LLQueuedThread::setPriority(), LLMutex::unlock(), and WCF_ABORT_REQUESTED.

void LLWorkerClass::addWork ( S32  param,
U32  priority = LLWorkerThread::PRIORITY_NORMAL 
) [protected]

Definition at line 274 of file llworkerthread.cpp.

References LLWorkerThread::addWorkRequest(), clearFlags(), llassert_always, llendl, llerrs, LLMutex::lock(), mMutex, mRequestHandle, mWorkerThread, mWorkFlags, LLQueuedThread::nullHandle(), setFlags(), startWork(), LLMutex::unlock(), WCF_HAVE_WORK, WCF_WORK_ABORTED, WCF_WORK_FINISHED, and WCF_WORKING.

Referenced by LLTextureFetch::createRequest(), LLTextureFetch::getRequestFinished(), LLTextureFetchWorker::LLTextureFetchWorker(), LLTextureCacheWorker::read(), LLImageWorker::requestDecodedAuxData(), LLTextureFetchWorker::setDesiredDiscard(), and LLTextureCacheWorker::write().

bool LLWorkerClass::checkWork ( bool  aborting = false  )  [protected]

Definition at line 310 of file llworkerthread.cpp.

References clearFlags(), LLQueuedThread::completeRequest(), endWork(), LLQueuedThread::FLAG_ABORT, getFlags(), LLQueuedThread::QueuedRequest::getFlags(), LLWorkerThread::WorkRequest::getParam(), LLQueuedThread::getRequest(), LLQueuedThread::QueuedRequest::getStatus(), llassert_always, mMutex, mRequestHandle, mWorkerThread, LLQueuedThread::nullHandle(), LLQueuedThread::STATUS_ABORTED, LLQueuedThread::STATUS_COMPLETE, WCF_HAVE_WORK, and WCF_WORKING.

Referenced by LLTextureCacheWorker::complete(), LLTextureFetch::getRequestFinished(), and LLImageWorker::requestDecodedAuxData().

void LLWorkerClass::clearFlags ( U32  flags  )  [inline, private]

Definition at line 179 of file llworkerthread.h.

References mWorkFlags.

Referenced by addWork(), checkWork(), and setWorking().

bool LLWorkerClass::deleteOK (  )  [virtual]

Reimplemented in LLTextureFetchWorker.

Definition at line 234 of file llworkerthread.cpp.

Referenced by LLWorkerThread::update().

virtual bool LLWorkerClass::doWork ( S32  param  )  [pure virtual]

Implemented in LLImageWorker, LLTextureCacheWorker, and LLTextureFetchWorker.

Referenced by LLWorkerThread::WorkRequest::processRequest().

virtual void LLWorkerClass::endWork ( S32  param,
bool  aborted 
) [private, pure virtual]

Implemented in LLImageWorker, LLTextureCacheWorker, and LLTextureFetchWorker.

Referenced by checkWork().

void LLWorkerClass::finishWork ( S32  param,
bool  completed 
) [virtual]

Reimplemented in LLTextureCacheWorker, and LLTextureFetchWorker.

Definition at line 229 of file llworkerthread.cpp.

Referenced by LLWorkerThread::WorkRequest::finishRequest().

bool LLWorkerClass::getFlags ( U32  flags  )  [inline, private]

Definition at line 181 of file llworkerthread.h.

References mWorkFlags.

U32 LLWorkerClass::getFlags (  )  [inline, private]

Definition at line 180 of file llworkerthread.h.

References mWorkFlags.

Referenced by checkWork(), haveWork(), isWorking(), scheduleDelete(), LLWorkerThread::update(), wasAborted(), and yield().

const std::string& LLWorkerClass::getName (  )  const [inline]

Definition at line 155 of file llworkerthread.h.

References mWorkerClassName.

U32 LLWorkerClass::getPriority (  )  [inline]

Definition at line 153 of file llworkerthread.h.

References mRequestPriority.

Referenced by LLTextureFetch::getFetchState(), and LLTextureFetchWorker::setImagePriority().

bool LLWorkerClass::haveWork (  )  [inline]

Definition at line 147 of file llworkerthread.h.

References getFlags(), and WCF_HAVE_WORK.

Referenced by LLTextureFetch::createRequest(), LLTextureFetchWorker::deleteOK(), LLTextureFetch::getFetchState(), LLTextureFetch::getRequestFinished(), LLImageWorker::requestDecodedAuxData(), LLTextureFetchWorker::setDesiredDiscard(), LLTextureCacheWorker::~LLTextureCacheWorker(), and LLTextureFetchWorker::~LLTextureFetchWorker().

bool LLWorkerClass::isWorking (  )  [inline]

Definition at line 148 of file llworkerthread.h.

References getFlags(), and WCF_WORKING.

void LLWorkerClass::scheduleDelete (  ) 

Definition at line 348 of file llworkerthread.cpp.

References LLWorkerThread::deleteWorker(), getFlags(), LLMutex::lock(), mMutex, mWorkerThread, setFlags(), LLMutex::unlock(), and WCF_DELETE_REQUESTED.

Referenced by LLTextureFetchWorker::decodeImage(), LLTextureFetchWorker::endWork(), LLTextureFetch::removeRequest(), and LLTextureFetchWorker::~LLTextureFetchWorker().

void LLWorkerClass::setFlags ( U32  flags  )  [inline, private]

Definition at line 178 of file llworkerthread.h.

References mWorkFlags.

Referenced by abortWork(), addWork(), LLWorkerThread::WorkRequest::finishRequest(), scheduleDelete(), and setWorking().

void LLWorkerClass::setPriority ( U32  priority  ) 

Definition at line 364 of file llworkerthread.cpp.

References LLMutex::lock(), mMutex, mRequestHandle, mRequestPriority, mWorkerThread, LLQueuedThread::nullHandle(), LLQueuedThread::setPriority(), and LLMutex::unlock().

Referenced by LLTextureFetchWorker::callbackCacheRead(), LLTextureFetchWorker::callbackCacheWrite(), LLTextureFetchWorker::callbackDecoded(), LLTextureFetchWorker::callbackHttpGet(), LLTextureFetchWorker::callbackURLReceived(), LLTextureCacheWorker::doRead(), LLTextureFetchWorker::doWork(), LLTextureCacheWorker::doWrite(), LLTextureCacheWorker::ioComplete(), LLTextureFetch::receiveImageHeader(), LLTextureFetch::receiveImagePacket(), LLTextureFetchWorker::setDesiredDiscard(), and LLTextureFetchWorker::setImagePriority().

void LLWorkerClass::setWorkerThread ( LLWorkerThread workerthread  )  [protected]

Definition at line 215 of file llworkerthread.cpp.

References llendl, llerrs, LLMutex::lock(), mMutex, mRequestHandle, mWorkerThread, LLQueuedThread::nullHandle(), and LLMutex::unlock().

void LLWorkerClass::setWorking ( bool  working  )  [protected]

Definition at line 242 of file llworkerthread.cpp.

References clearFlags(), llassert_always, LLMutex::lock(), mMutex, mWorkFlags, setFlags(), LLMutex::unlock(), and WCF_WORKING.

Referenced by LLWorkerThread::WorkRequest::processRequest().

virtual void LLWorkerClass::startWork ( S32  param  )  [private, pure virtual]

Implemented in LLImageWorker, LLTextureCacheWorker, and LLTextureFetchWorker.

Referenced by addWork().

bool LLWorkerClass::wasAborted (  )  [inline]

Definition at line 149 of file llworkerthread.h.

References getFlags(), and WCF_ABORT_REQUESTED.

Referenced by LLTextureFetch::createRequest(), LLImageWorker::doWork(), and LLTextureFetch::getRequestFinished().

bool LLWorkerClass::yield (  )  [protected]

Definition at line 260 of file llworkerthread.cpp.

References LLThread::checkPause(), getFlags(), LLMutex::lock(), mMutex, mWorkerThread, LLMutex::unlock(), WCF_ABORT_REQUESTED, and LLThread::yield().


Friends And Related Function Documentation

friend class LLWorkerThread [friend]

Definition at line 119 of file llworkerthread.h.

friend class LLWorkerThread::WorkRequest [friend]

Definition at line 120 of file llworkerthread.h.


Member Data Documentation

LLMutex LLWorkerClass::mMutex [private]

Definition at line 195 of file llworkerthread.h.

Referenced by abortWork(), addWork(), checkWork(), scheduleDelete(), setPriority(), setWorkerThread(), setWorking(), and yield().

handle_t LLWorkerClass::mRequestHandle [protected]

Definition at line 191 of file llworkerthread.h.

Referenced by abortWork(), addWork(), checkWork(), LLTextureCacheWorker::doRead(), LLTextureCacheWorker::doWrite(), LLTextureCacheWorker::read(), setPriority(), setWorkerThread(), LLTextureCacheWorker::write(), and ~LLWorkerClass().

U32 LLWorkerClass::mRequestPriority [protected]

Definition at line 192 of file llworkerthread.h.

Referenced by getPriority(), and setPriority().

std::string LLWorkerClass::mWorkerClassName [protected]

Definition at line 190 of file llworkerthread.h.

Referenced by getName().

LLWorkerThread* LLWorkerClass::mWorkerThread [protected]

Definition at line 189 of file llworkerthread.h.

Referenced by abortWork(), addWork(), checkWork(), LLWorkerClass(), scheduleDelete(), setPriority(), setWorkerThread(), yield(), and ~LLWorkerClass().

LLAtomicU32 LLWorkerClass::mWorkFlags [private]

Definition at line 196 of file llworkerthread.h.

Referenced by addWork(), clearFlags(), getFlags(), setFlags(), setWorking(), and ~LLWorkerClass().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:12:04 2010 for Second Life Viewer by  doxygen 1.4.7