RandomAccessFileDeviceTest::Listener Class Reference

List of all members.

Public Member Functions

 Listener (int nTargetInit)
virtual ~Listener ()
StrictMutexgetMutex ()
void notifyTransferCompletion (bool b)
void waitForAll ()

Public Attributes

int nTarget
int nSuccess
int nCompleted

Private Attributes

StrictMutex mutex
LocalCondition cond

Detailed Description

Definition at line 132 of file RandomAccessFileDeviceTest.cpp.


Constructor & Destructor Documentation

RandomAccessFileDeviceTest::Listener::Listener ( int  nTargetInit  )  [inline, explicit]

Definition at line 142 of file RandomAccessFileDeviceTest.cpp.

References nCompleted, nSuccess, and nTarget.

00143         {
00144             nTarget = nTargetInit;
00145             nSuccess = 0;
00146             nCompleted = 0;
00147         }

virtual RandomAccessFileDeviceTest::Listener::~Listener (  )  [inline, virtual]

Definition at line 148 of file RandomAccessFileDeviceTest.cpp.

00149         {
00150         }


Member Function Documentation

StrictMutex& RandomAccessFileDeviceTest::Listener::getMutex (  )  [inline]

Definition at line 152 of file RandomAccessFileDeviceTest.cpp.

References mutex.

Referenced by RandomAccessFileDeviceTest::testAsyncIOImpl().

00153         {
00154             return mutex;
00155         }

void RandomAccessFileDeviceTest::Listener::notifyTransferCompletion ( bool  b  )  [inline]

Definition at line 157 of file RandomAccessFileDeviceTest.cpp.

References cond, mutex, nCompleted, nSuccess, and nTarget.

Referenced by RandomAccessFileDeviceTest::Binding::notifyTransferCompletion().

00158         {
00159             StrictMutexGuard mutexGuard(mutex);
00160             if (b) {
00161                 nSuccess++;
00162             }
00163             nCompleted++;
00164             if (nCompleted == nTarget) {
00165                 cond.notify_all();
00166             }
00167         }

void RandomAccessFileDeviceTest::Listener::waitForAll (  )  [inline]

Definition at line 169 of file RandomAccessFileDeviceTest.cpp.

References cond, mutex, nCompleted, and nTarget.

Referenced by RandomAccessFileDeviceTest::testAsyncIOImpl().

00170         {
00171             StrictMutexGuard mutexGuard(mutex);
00172             while (nCompleted < nTarget) {
00173                 cond.wait(mutexGuard);
00174             }
00175         }


Member Data Documentation

StrictMutex RandomAccessFileDeviceTest::Listener::mutex [private]

Definition at line 134 of file RandomAccessFileDeviceTest.cpp.

Referenced by getMutex(), notifyTransferCompletion(), and waitForAll().

LocalCondition RandomAccessFileDeviceTest::Listener::cond [private]

Definition at line 135 of file RandomAccessFileDeviceTest.cpp.

Referenced by notifyTransferCompletion(), and waitForAll().

int RandomAccessFileDeviceTest::Listener::nTarget

Definition at line 138 of file RandomAccessFileDeviceTest.cpp.

Referenced by Listener(), notifyTransferCompletion(), and waitForAll().

int RandomAccessFileDeviceTest::Listener::nSuccess

Definition at line 139 of file RandomAccessFileDeviceTest.cpp.

Referenced by Listener(), notifyTransferCompletion(), and RandomAccessFileDeviceTest::testAsyncIOImpl().

int RandomAccessFileDeviceTest::Listener::nCompleted

Definition at line 140 of file RandomAccessFileDeviceTest.cpp.

Referenced by Listener(), notifyTransferCompletion(), and waitForAll().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:44 2009 for Fennel by  doxygen 1.5.1