#include <llworkerthread.h>
Public Types | |
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 } |
typedef LLWorkerThread::handle_t | handle_t |
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 | |
LLWorkerThread * | mWorkerThread |
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 |
Definition at line 117 of file llworkerthread.h.
Definition at line 122 of file llworkerthread.h.
enum LLWorkerClass::FLAGS |
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.
LLWorkerClass::LLWorkerClass | ( | LLWorkerThread * | workerthread, | |
const std::string & | name | |||
) |
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.
virtual bool LLWorkerClass::doWork | ( | S32 | param | ) | [pure virtual] |
Implemented in LLImageWorker, LLTextureCacheWorker, and LLTextureFetchWorker.
Referenced by LLWorkerThread::WorkRequest::processRequest().
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::deleteOK | ( | ) | [virtual] |
Reimplemented in LLTextureFetchWorker.
Definition at line 234 of file llworkerthread.cpp.
Referenced by LLWorkerThread::update().
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().
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.
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().
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(), LLTextureCacheRemoteWorker::doRead(), LLTextureCacheLocalFileWorker::doRead(), LLTextureFetchWorker::doWork(), LLTextureCacheRemoteWorker::doWrite(), LLTextureCacheWorker::ioComplete(), LLTextureFetch::receiveImageHeader(), LLTextureFetch::receiveImagePacket(), LLTextureFetchWorker::setDesiredDiscard(), LLTextureFetchWorker::setImagePriority(), and LLTextureCache::update().
U32 LLWorkerClass::getPriority | ( | ) | [inline] |
Definition at line 153 of file llworkerthread.h.
References mRequestPriority.
Referenced by LLTextureFetch::getFetchState(), and LLTextureFetchWorker::setImagePriority().
const std::string& LLWorkerClass::getName | ( | ) | const [inline] |
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().
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().
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::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().
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.
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(), indra::ipc::saranwrap::status(), LLQueuedThread::STATUS_ABORTED, LLQueuedThread::STATUS_COMPLETE, WCF_HAVE_WORK, and WCF_WORKING.
Referenced by LLTextureCacheWorker::complete(), LLTextureFetch::getRequestFinished(), and LLImageWorker::requestDecodedAuxData().
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::clearFlags | ( | U32 | flags | ) | [inline, private] |
Definition at line 179 of file llworkerthread.h.
References mWorkFlags.
Referenced by addWork(), checkWork(), setWorking(), and LLWorkerThread::update().
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().
bool LLWorkerClass::getFlags | ( | U32 | flags | ) | [inline, private] |
virtual void LLWorkerClass::startWork | ( | S32 | param | ) | [private, pure virtual] |
Implemented in LLImageWorker, LLTextureCacheWorker, and LLTextureFetchWorker.
Referenced by addWork().
virtual void LLWorkerClass::endWork | ( | S32 | param, | |
bool | aborted | |||
) | [private, pure virtual] |
Implemented in LLImageWorker, LLTextureCacheWorker, and LLTextureFetchWorker.
Referenced by checkWork().
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.
LLWorkerThread* LLWorkerClass::mWorkerThread [protected] |
Definition at line 189 of file llworkerthread.h.
Referenced by abortWork(), addWork(), checkWork(), LLWorkerClass(), scheduleDelete(), setPriority(), setWorkerThread(), yield(), and ~LLWorkerClass().
std::string LLWorkerClass::mWorkerClassName [protected] |
handle_t LLWorkerClass::mRequestHandle [protected] |
Definition at line 191 of file llworkerthread.h.
Referenced by abortWork(), addWork(), checkWork(), LLTextureCacheRemoteWorker::doRead(), LLTextureCacheLocalFileWorker::doRead(), LLTextureCacheRemoteWorker::doWrite(), LLTextureCacheWorker::read(), setPriority(), setWorkerThread(), LLWorkerThread::update(), LLTextureCacheWorker::write(), and ~LLWorkerClass().
U32 LLWorkerClass::mRequestPriority [protected] |
LLMutex LLWorkerClass::mMutex [private] |
Definition at line 195 of file llworkerthread.h.
Referenced by abortWork(), addWork(), checkWork(), scheduleDelete(), setPriority(), setWorkerThread(), setWorking(), and yield().
LLAtomicU32 LLWorkerClass::mWorkFlags [private] |
Definition at line 196 of file llworkerthread.h.
Referenced by addWork(), clearFlags(), getFlags(), setFlags(), setWorking(), and ~LLWorkerClass().