LLQueuedThread Class Reference

#include <llqueuedthread.h>

Inheritance diagram for LLQueuedThread:

Inheritance graph
[legend]
Collaboration diagram for LLQueuedThread:

Collaboration graph
[legend]
List of all members.

Public Types

typedef U32 handle_t
 PRIORITY_IMMEDIATE = 0x7FFFFFFF
 PRIORITY_URGENT = 0x40000000
 PRIORITY_HIGH = 0x30000000
 PRIORITY_NORMAL = 0x20000000
 PRIORITY_LOW = 0x10000000
 PRIORITY_LOWBITS = 0x0FFFFFFF
 PRIORITY_HIGHBITS = 0x70000000
 STATUS_EXPIRED = -1
 STATUS_UNKNOWN = 0
 STATUS_QUEUED = 1
 STATUS_INPROGRESS = 2
 STATUS_COMPLETE = 3
 STATUS_ABORTED = 4
 STATUS_DELETE = 5
 FLAG_AUTO_COMPLETE = 1
 FLAG_AUTO_DELETE = 2
 FLAG_ABORT = 4
enum  priority_t {
  PRIORITY_IMMEDIATE = 0x7FFFFFFF, PRIORITY_URGENT = 0x40000000, PRIORITY_HIGH = 0x30000000, PRIORITY_NORMAL = 0x20000000,
  PRIORITY_LOW = 0x10000000, PRIORITY_LOWBITS = 0x0FFFFFFF, PRIORITY_HIGHBITS = 0x70000000
}
enum  status_t {
  STATUS_EXPIRED = -1, STATUS_UNKNOWN = 0, STATUS_QUEUED = 1, STATUS_INPROGRESS = 2,
  STATUS_COMPLETE = 3, STATUS_ABORTED = 4, STATUS_DELETE = 5
}
enum  flags_t { FLAG_AUTO_COMPLETE = 1, FLAG_AUTO_DELETE = 2, FLAG_ABORT = 4 }

Public Member Functions

 LLQueuedThread (const std::string &name, bool threaded=true)
virtual ~LLQueuedThread ()
virtual void shutdown ()
bool waitForResult (handle_t handle, bool auto_complete=true)
virtual S32 update (U32 max_time_ms)
S32 updateQueue (U32 max_time_ms)
void waitOnPending ()
void printQueueStats ()
S32 getPending ()
bool getThreaded ()
status_t getRequestStatus (handle_t handle)
void abortRequest (handle_t handle, bool autocomplete)
void setFlags (handle_t handle, U32 flags)
void setPriority (handle_t handle, U32 priority)
bool completeRequest (handle_t handle)
QueuedRequestgetRequest (handle_t handle)
bool check ()

Static Public Member Functions

static handle_t nullHandle ()

Protected Types

typedef std::set< QueuedRequest *,
queued_request_less
request_queue_t
typedef LLSimpleHash< handle_t,
REQUEST_HASH_SIZE > 
request_hash_t
 REQUEST_HASH_SIZE = 512
enum  { REQUEST_HASH_SIZE = 512 }

Protected Member Functions

handle_t generateHandle ()
bool addRequest (QueuedRequest *req)
S32 processNextRequest (void)
void incQueue ()

Protected Attributes

BOOL mThreaded
LLAtomic32< BOOLmIdleThread
request_queue_t mRequestQueue
request_hash_t mRequestHash
handle_t mNextHandle

Private Member Functions

 LLQueuedThread (const LLQueuedThread &)
LLQueuedThreadoperator= (const LLQueuedThread &)
virtual bool runCondition (void)
virtual void run (void)

Classes

struct  queued_request_less
class  QueuedRequest

Detailed Description

Definition at line 49 of file llqueuedthread.h.


Member Typedef Documentation

typedef U32 LLQueuedThread::handle_t

Definition at line 77 of file llqueuedthread.h.

typedef LLSimpleHash<handle_t, REQUEST_HASH_SIZE> LLQueuedThread::request_hash_t [protected]

Definition at line 207 of file llqueuedthread.h.

typedef std::set<QueuedRequest*, queued_request_less> LLQueuedThread::request_queue_t [protected]

Definition at line 203 of file llqueuedthread.h.


Member Enumeration Documentation

anonymous enum [protected]

Enumerator:
REQUEST_HASH_SIZE 

Definition at line 206 of file llqueuedthread.h.

enum LLQueuedThread::flags_t

Enumerator:
FLAG_AUTO_COMPLETE 
FLAG_AUTO_DELETE 
FLAG_ABORT 

Definition at line 71 of file llqueuedthread.h.

enum LLQueuedThread::priority_t

Enumerator:
PRIORITY_IMMEDIATE 
PRIORITY_URGENT 
PRIORITY_HIGH 
PRIORITY_NORMAL 
PRIORITY_LOW 
PRIORITY_LOWBITS 
PRIORITY_HIGHBITS 

Definition at line 53 of file llqueuedthread.h.

enum LLQueuedThread::status_t

Enumerator:
STATUS_EXPIRED 
STATUS_UNKNOWN 
STATUS_QUEUED 
STATUS_INPROGRESS 
STATUS_COMPLETE 
STATUS_ABORTED 
STATUS_DELETE 

Definition at line 62 of file llqueuedthread.h.


Constructor & Destructor Documentation

LLQueuedThread::LLQueuedThread ( const std::string &  name,
bool  threaded = true 
)

Definition at line 38 of file llqueuedthread.cpp.

References mThreaded, and LLThread::start().

LLQueuedThread::~LLQueuedThread (  )  [virtual]

Definition at line 51 of file llqueuedthread.cpp.

References shutdown().

LLQueuedThread::LLQueuedThread ( const LLQueuedThread  )  [private]


Member Function Documentation

void LLQueuedThread::abortRequest ( handle_t  handle,
bool  autocomplete 
)

Definition at line 292 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), FLAG_ABORT, FLAG_AUTO_COMPLETE, LLThread::lockData(), mRequestHash, LLQueuedThread::QueuedRequest::setFlags(), and LLThread::unlockData().

Referenced by LLWorkerClass::abortWork().

bool LLQueuedThread::addRequest ( QueuedRequest req  )  [protected]

Definition at line 204 of file llqueuedthread.cpp.

References incQueue(), LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::insert(), LLThread::lockData(), mRequestHash, mRequestQueue, LLThread::mStatus, LLThread::QUITTING, LLQueuedThread::QueuedRequest::setStatus(), STATUS_QUEUED, and LLThread::unlockData().

Referenced by LLWorkerThread::addWorkRequest(), LLVFSThread::read(), LLLFSThread::read(), LLVFSThread::readImmediate(), LLVFSThread::write(), LLLFSThread::write(), and LLVFSThread::writeImmediate().

bool LLQueuedThread::check (  ) 

Definition at line 358 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::get_element_at_index(), i, llendl, llerrs, mNextHandle, mRequestHash, and REQUEST_HASH_SIZE.

bool LLQueuedThread::completeRequest ( handle_t  handle  ) 

Definition at line 337 of file llqueuedthread.cpp.

References LLQueuedThread::QueuedRequest::deleteRequest(), LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::erase(), LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLQueuedThread::QueuedRequest::getStatus(), llassert_always, LLThread::lockData(), mRequestHash, STATUS_INPROGRESS, STATUS_QUEUED, and LLThread::unlockData().

Referenced by LLWorkerClass::checkWork(), LLVFile::isReadComplete(), LLVFSThread::readImmediate(), LLWorkerThread::update(), and LLVFSThread::writeImmediate().

LLQueuedThread::handle_t LLQueuedThread::generateHandle (  )  [protected]

Definition at line 192 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLThread::lockData(), mNextHandle, mRequestHash, nullHandle(), and LLThread::unlockData().

Referenced by LLWorkerThread::addWorkRequest(), LLVFSThread::read(), LLLFSThread::read(), LLVFSThread::readImmediate(), LLVFSThread::write(), LLLFSThread::write(), and LLVFSThread::writeImmediate().

S32 LLQueuedThread::getPending (  ) 

Definition at line 147 of file llqueuedthread.cpp.

References LLThread::lockData(), mRequestQueue, S32, and LLThread::unlockData().

Referenced by LLVFSThread::cleanupClass(), LLLFSThread::cleanupClass(), LLGLTexMemBar::draw(), processNextRequest(), LLVFile::setMaxSize(), LLVFSThread::updateClass(), LLLFSThread::updateClass(), and updateQueue().

LLQueuedThread::QueuedRequest * LLQueuedThread::getRequest ( handle_t  handle  ) 

Definition at line 267 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLThread::lockData(), mRequestHash, nullHandle(), and LLThread::unlockData().

Referenced by LLWorkerClass::checkWork(), LLVFile::isReadComplete(), and LLWorkerClass::~LLWorkerClass().

LLQueuedThread::status_t LLQueuedThread::getRequestStatus ( handle_t  handle  ) 

Definition at line 279 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLQueuedThread::QueuedRequest::getStatus(), LLThread::lockData(), mRequestHash, STATUS_EXPIRED, and LLThread::unlockData().

bool LLQueuedThread::getThreaded (  )  [inline]

Definition at line 184 of file llqueuedthread.h.

References mThreaded.

void LLQueuedThread::incQueue (  )  [protected]

Definition at line 133 of file llqueuedthread.cpp.

References LLThread::isPaused(), mThreaded, and LLThread::wake().

Referenced by addRequest().

static handle_t LLQueuedThread::nullHandle (  )  [inline, static]

Definition at line 153 of file llqueuedthread.h.

Referenced by LLWorkerClass::abortWork(), LLWorkerClass::addWork(), LLWorkerThread::addWorkRequest(), LLWorkerClass::checkWork(), LLTextureFetchWorker::deleteOK(), LLTextureCacheWorker::doRead(), LLTextureFetchWorker::doWork(), LLTextureCacheWorker::doWrite(), LLVorbisDecodeState::finishDecode(), LLTextureFetchWorker::finishWork(), generateHandle(), getRequest(), LLVFile::isReadComplete(), LLVFile::LLVFile(), LLVorbisDecodeState::LLVorbisDecodeState(), LLVFSThread::read(), LLVFile::read(), LLVFile::remove(), LLVFile::rename(), LLWorkerClass::setPriority(), LLVFile::setReadPriority(), LLWorkerClass::setWorkerThread(), LLWorkerThread::update(), waitForResult(), LLVFSThread::write(), LLVFile::write(), LLTextureCache::writeToCache(), LLTextureFetchWorker::writeToCacheComplete(), LLTextureFetchWorker::~LLTextureFetchWorker(), LLVFile::~LLVFile(), and LLWorkerClass::~LLWorkerClass().

LLQueuedThread& LLQueuedThread::operator= ( const LLQueuedThread  )  [private]

void LLQueuedThread::printQueueStats (  ) 

Definition at line 176 of file llqueuedthread.cpp.

References llendl, llformat(), llinfos, LLThread::lockData(), mRequestQueue, and LLThread::unlockData().

S32 LLQueuedThread::processNextRequest ( void   )  [protected]

Definition at line 381 of file llqueuedthread.cpp.

References LLQueuedThread::QueuedRequest::deleteRequest(), LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::erase(), LLQueuedThread::QueuedRequest::finishRequest(), FLAG_ABORT, FLAG_AUTO_COMPLETE, LLQueuedThread::QueuedRequest::getFlags(), getPending(), LLQueuedThread::QueuedRequest::getPriority(), LLQueuedThread::QueuedRequest::getStatus(), LLThread::isQuitting(), llassert_always, LLThread::lockData(), mRequestHash, mRequestQueue, ms_sleep(), LLThread::mStatus, NULL, PRIORITY_NORMAL, LLQueuedThread::QueuedRequest::processRequest(), LLThread::QUITTING, S32, LLQueuedThread::QueuedRequest::setStatus(), STATUS_ABORTED, STATUS_COMPLETE, STATUS_INPROGRESS, STATUS_QUEUED, and LLThread::unlockData().

Referenced by run(), and updateQueue().

void LLQueuedThread::run ( void   )  [private, virtual]

Implements LLThread.

Definition at line 480 of file llqueuedthread.cpp.

References LLThread::checkPause(), FALSE, LLThread::isQuitting(), llendl, llinfos, mIdleThread, LLThread::mName, processNextRequest(), and TRUE.

bool LLQueuedThread::runCondition ( void   )  [private, virtual]

Reimplemented from LLThread.

Definition at line 471 of file llqueuedthread.cpp.

References mIdleThread, and mRequestQueue.

void LLQueuedThread::setFlags ( handle_t  handle,
U32  flags 
)

Definition at line 304 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLThread::lockData(), mRequestHash, LLQueuedThread::QueuedRequest::setFlags(), and LLThread::unlockData().

Referenced by LLVFile::~LLVFile().

void LLQueuedThread::setPriority ( handle_t  handle,
U32  priority 
)

Definition at line 315 of file llqueuedthread.cpp.

References LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLQueuedThread::QueuedRequest::getStatus(), llverify, LLThread::lockData(), mRequestHash, mRequestQueue, LLQueuedThread::QueuedRequest::setPriority(), STATUS_INPROGRESS, STATUS_QUEUED, and LLThread::unlockData().

Referenced by LLWorkerClass::abortWork(), LLWorkerClass::setPriority(), and LLVFile::setReadPriority().

void LLQueuedThread::shutdown (  )  [virtual]

Reimplemented from LLThread.

Definition at line 57 of file llqueuedthread.cpp.

References LLQueuedThread::QueuedRequest::deleteRequest(), LLQueuedThread::QueuedRequest::getStatus(), LLThread::isStopped(), llendl, llwarns, LLThread::mName, mRequestHash, ms_sleep(), LLThread::mStatus, mThreaded, LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::pop_element(), S32, LLThread::setQuitting(), STATUS_INPROGRESS, STATUS_QUEUED, LLThread::STOPPED, LLThread::unpause(), and LLThread::yield().

Referenced by cleanup_app(), and ~LLQueuedThread().

S32 LLQueuedThread::update ( U32  max_time_ms  )  [virtual]

Reimplemented in LLWorkerThread, LLTextureCache, and LLTextureFetch.

Definition at line 104 of file llqueuedthread.cpp.

References updateQueue().

Referenced by LLVFSThread::cleanupClass(), LLLFSThread::cleanupClass(), LLVFile::setMaxSize(), LLWorkerThread::update(), LLVFSThread::updateClass(), LLLFSThread::updateClass(), LLVFile::waitForLock(), waitForResult(), and waitOnPending().

S32 LLQueuedThread::updateQueue ( U32  max_time_ms  ) 

Definition at line 109 of file llqueuedthread.cpp.

References LLTimer::getElapsedTimeF64(), getPending(), mThreaded, processNextRequest(), S32, and LLThread::unpause().

Referenced by update().

bool LLQueuedThread::waitForResult ( handle_t  handle,
bool  auto_complete = true 
)

Definition at line 226 of file llqueuedthread.cpp.

References LLQueuedThread::QueuedRequest::deleteRequest(), LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::erase(), LLSimpleHash< HASH_KEY_TYPE, TABLE_SIZE >::find(), LLQueuedThread::QueuedRequest::getStatus(), LLThread::isPaused(), llassert, LLThread::lockData(), mRequestHash, mThreaded, nullHandle(), LLThread::pause(), STATUS_COMPLETE, LLThread::unlockData(), update(), and LLThread::yield().

Referenced by LLVFSThread::readImmediate(), and LLVFSThread::writeImmediate().

void LLQueuedThread::waitOnPending (  ) 

Definition at line 157 of file llqueuedthread.cpp.

References mIdleThread, mThreaded, update(), and LLThread::yield().


Member Data Documentation

LLAtomic32<BOOL> LLQueuedThread::mIdleThread [protected]

Definition at line 201 of file llqueuedthread.h.

Referenced by run(), runCondition(), and waitOnPending().

handle_t LLQueuedThread::mNextHandle [protected]

Definition at line 210 of file llqueuedthread.h.

Referenced by check(), and generateHandle().

request_hash_t LLQueuedThread::mRequestHash [protected]

Definition at line 208 of file llqueuedthread.h.

Referenced by abortRequest(), addRequest(), check(), completeRequest(), generateHandle(), getRequest(), getRequestStatus(), processNextRequest(), setFlags(), setPriority(), shutdown(), and waitForResult().

request_queue_t LLQueuedThread::mRequestQueue [protected]

Definition at line 204 of file llqueuedthread.h.

Referenced by addRequest(), LLTextureFetch::dump(), getPending(), printQueueStats(), processNextRequest(), runCondition(), and setPriority().

BOOL LLQueuedThread::mThreaded [protected]

Definition at line 200 of file llqueuedthread.h.

Referenced by getThreaded(), incQueue(), LLQueuedThread(), shutdown(), updateQueue(), waitForResult(), and waitOnPending().


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