|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| AtlasDeferredFile () | |
| ~AtlasDeferredFile () | |
| bool | initStream (const char *filename, U32 mode) |
| Initialize access to a specified file, with the appropriate IO mode. | |
| void | start () |
| Start the deferred IO thread. | |
| void | stop () |
| Stop the deferred IO thread. | |
| void | sync () |
| Synch with the deferred IO thread and do appropriate callbacks for any finished IO operations, as described in the AtlasDeferredIO class. | |
| void | queue (AtlasDeferredIO *io) |
| Queue an ADIO. | |
| void | ensureStreamWritable () |
| Make sure that we have acquired ability to write to stream. | |
| Stream * | lockStream (bool needWrite=false) |
| Get the file stream for exclusive access. Don't forget to call unlockStream()! | |
| void | unlockStream () |
| Unlock the stream after exclusive mode IO is completed. | |
| const bool | hasStream () const |
| Do we currently have an active stream? | |
| bool | isLoading () |
| Return true if we currently have an IO activity going on. | |
| void * | getLoadingMutex () |
| bool | hasPendingIO () |
| Return true if we have any pending or in-process IO operations. | |
| const U32 | getTimeSpentWorking () const |
| Return the time in ms that the IO thread has spent working. | |
| const U32 | getTimeSpentWaiting () const |
| Return the time in ms that the IO thread has spent waiting. | |
| const U32 | getLoadOperationsCompleted () const |
| Return the number of operation the background thread has completed. | |
Private Member Functions | |
| void | loaderThread () |
Static Private Member Functions | |
| static void | loaderThunk (void *a) |
Private Attributes | |
| const char * | mFilename |
| void * | mStreamMutex |
| Stream * | mStream |
| ThreadSafeQueue< AtlasDeferredIO * > | mDeferredRequestQueue |
| ThreadSafeQueue< AtlasDeferredIO * > | mDeferredResultQueue |
| bool | mCanWriteStream |
| void * | mLoadingMutex |
| Semaphore * | mLoadingSemaphore |
| Thread * | mDeferredLoaderThread |
| volatile bool | mDeferredLoaderThreadActive |
| volatile U32 | mTimeSpentWorking |
| volatile U32 | mTimeSpentWaiting |
| volatile U32 | mLoadOperationsCompleted |
| AtlasDeferredFile::AtlasDeferredFile | ( | ) |
| AtlasDeferredFile::~AtlasDeferredFile | ( | ) |
| void AtlasDeferredFile::loaderThread | ( | ) | [private] |
Initialize access to a specified file, with the appropriate IO mode.
| void AtlasDeferredFile::start | ( | ) |
Start the deferred IO thread.
| void AtlasDeferredFile::stop | ( | ) |
Stop the deferred IO thread.
| void AtlasDeferredFile::sync | ( | ) |
Synch with the deferred IO thread and do appropriate callbacks for any finished IO operations, as described in the AtlasDeferredIO class.
| void AtlasDeferredFile::queue | ( | AtlasDeferredIO * | io | ) |
Queue an ADIO.
| void AtlasDeferredFile::ensureStreamWritable | ( | ) |
Make sure that we have acquired ability to write to stream.
Get the file stream for exclusive access. Don't forget to call unlockStream()!
| void AtlasDeferredFile::unlockStream | ( | ) | [inline] |
Unlock the stream after exclusive mode IO is completed.
| const bool AtlasDeferredFile::hasStream | ( | ) | const [inline] |
Do we currently have an active stream?
| bool AtlasDeferredFile::isLoading | ( | ) | [inline] |
Return true if we currently have an IO activity going on.
| void* AtlasDeferredFile::getLoadingMutex | ( | ) | [inline] |
| bool AtlasDeferredFile::hasPendingIO | ( | ) |
Return true if we have any pending or in-process IO operations.
| const U32 AtlasDeferredFile::getTimeSpentWorking | ( | ) | const [inline] |
Return the time in ms that the IO thread has spent working.
| const U32 AtlasDeferredFile::getTimeSpentWaiting | ( | ) | const [inline] |
Return the time in ms that the IO thread has spent waiting.
| const U32 AtlasDeferredFile::getLoadOperationsCompleted | ( | ) | const [inline] |
Return the number of operation the background thread has completed.
const char* AtlasDeferredFile::mFilename [private] |
void* AtlasDeferredFile::mStreamMutex [private] |
Stream* AtlasDeferredFile::mStream [private] |
bool AtlasDeferredFile::mCanWriteStream [private] |
void* AtlasDeferredFile::mLoadingMutex [private] |
Semaphore* AtlasDeferredFile::mLoadingSemaphore [private] |
Thread* AtlasDeferredFile::mDeferredLoaderThread [private] |
volatile bool AtlasDeferredFile::mDeferredLoaderThreadActive [private] |
volatile U32 AtlasDeferredFile::mTimeSpentWorking [private] |
volatile U32 AtlasDeferredFile::mTimeSpentWaiting [private] |
volatile U32 AtlasDeferredFile::mLoadOperationsCompleted [private] |