Added typedef so LockableTwoRefCounts uses thread-safe allocator.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@772 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2006-11-03 00:21:35 +00:00
parent 228666b49c
commit 1743fd1da3

View file

@ -114,12 +114,14 @@ void TwoRefCounts::ZapPointer( void )
#if defined (LOKI_OBJECT_LEVEL_THREADING) || defined (LOKI_CLASS_LEVEL_THREADING) #if defined (LOKI_OBJECT_LEVEL_THREADING) || defined (LOKI_CLASS_LEVEL_THREADING)
typedef SmallValueObject< ::Loki::ClassLevelLockable > ThreadSafePointerAllocator;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
LockableTwoRefCounts::LockableTwoRefCounts( bool strong ) LockableTwoRefCounts::LockableTwoRefCounts( bool strong )
: m_counts( NULL ) : m_counts( NULL )
{ {
void * temp = SmallObject<>::operator new( void * temp = ThreadSafePointerAllocator::operator new(
sizeof(Loki::Private::LockableTwoRefCountInfo) ); sizeof(Loki::Private::LockableTwoRefCountInfo) );
#ifdef DO_EXTRA_LOKI_TESTS #ifdef DO_EXTRA_LOKI_TESTS
assert( temp != 0 ); assert( temp != 0 );
@ -132,7 +134,7 @@ LockableTwoRefCounts::LockableTwoRefCounts( bool strong )
LockableTwoRefCounts::LockableTwoRefCounts( const void * p, bool strong ) LockableTwoRefCounts::LockableTwoRefCounts( const void * p, bool strong )
: m_counts( NULL ) : m_counts( NULL )
{ {
void * temp = SmallObject<>::operator new( void * temp = ThreadSafePointerAllocator::operator new(
sizeof(Loki::Private::LockableTwoRefCountInfo) ); sizeof(Loki::Private::LockableTwoRefCountInfo) );
#ifdef DO_EXTRA_LOKI_TESTS #ifdef DO_EXTRA_LOKI_TESTS
assert( temp != 0 ); assert( temp != 0 );
@ -191,7 +193,7 @@ void LockableTwoRefCounts::ZapPointer( void )
} }
else else
{ {
SmallObject<>::operator delete ( m_counts, ThreadSafePointerAllocator::operator delete ( m_counts,
sizeof(Loki::Private::LockableTwoRefCountInfo) ); sizeof(Loki::Private::LockableTwoRefCountInfo) );
m_counts = NULL; m_counts = NULL;
} }