DataBlockLockPool Class Reference

Holds and distributes locks to be used for locking ACE_Data_Blocks. Currently it does not require returning the locks. More...

#include <DataBlockLockPool.h>

Inheritance diagram for DataBlockLockPool:

Inheritance graph
[legend]
Collaboration diagram for DataBlockLockPool:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Lock_Adapter<
ACE_Thread_Mutex > 
DataBlockLock

Public Member Functions

 DataBlockLockPool (unsigned long size)
 ~DataBlockLockPool ()
DataBlockLockget_lock ()

Private Types

typedef ACE_Array< DataBlockLockPool

Private Attributes

Pool pool_
const unsigned long size_
ACE_Atomic_Op< ACE_Thread_Mutex,
unsigned long > 
iterator_
 Counter used to track which lock to give out next (modulus size_).

Detailed Description

Holds and distributes locks to be used for locking ACE_Data_Blocks. Currently it does not require returning the locks.

Note:
: The lock returned is not guaranteed to be unique.

: This class is thread safe.

Definition at line 28 of file DataBlockLockPool.h.


Member Typedef Documentation

typedef ACE_Lock_Adapter<ACE_Thread_Mutex> DataBlockLockPool::DataBlockLock

Definition at line 30 of file DataBlockLockPool.h.

typedef ACE_Array<DataBlockLock> DataBlockLockPool::Pool [private]

Definition at line 47 of file DataBlockLockPool.h.


Constructor & Destructor Documentation

DataBlockLockPool::DataBlockLockPool ( unsigned long  size  )  [inline]

Definition at line 32 of file DataBlockLockPool.h.

00033     : pool_(size),
00034       size_(size),
00035       iterator_(0)
00036   {
00037   }

DataBlockLockPool::~DataBlockLockPool (  )  [inline]

Definition at line 39 of file DataBlockLockPool.h.

00039 { }


Member Function Documentation

DataBlockLock* DataBlockLockPool::get_lock (  )  [inline]

Definition at line 41 of file DataBlockLockPool.h.

00041                              {
00042     unsigned long index = iterator_++ % size_;
00043     return &(pool_[index]);
00044   }


Member Data Documentation

ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> DataBlockLockPool::iterator_ [private]

Counter used to track which lock to give out next (modulus size_).

Definition at line 52 of file DataBlockLockPool.h.

Pool DataBlockLockPool::pool_ [private]

Definition at line 49 of file DataBlockLockPool.h.

const unsigned long DataBlockLockPool::size_ [private]

Definition at line 50 of file DataBlockLockPool.h.


The documentation for this class was generated from the following file:
Generated on Fri Feb 12 20:05:55 2016 for OpenDDS by  doxygen 1.4.7