use placement new

This commit is contained in:
Jeff Hill
2002-10-23 23:37:30 +00:00
parent 340e0c1d58
commit e36083d5ef
22 changed files with 712 additions and 455 deletions

View File

@@ -14,6 +14,8 @@
* (505) 665 1831
*/
#include <stdexcept>
#define epicsAssertAuthor "Jeff Hill johill@lanl.gov"
#define epicsExportSharedSymbols
@@ -24,19 +26,12 @@
#include "cac.h"
#include "sgAutoPtr.h"
epicsSingleton < tsFreeList < struct CASG, 128 > > CASG::pFreeList;
CASG::CASG ( ca_client_context &cacIn ) :
client ( cacIn ), magic ( CASG_MAGIC )
{
client.installCASG ( *this );
}
void CASG::destroy ()
{
delete this;
}
CASG::~CASG ()
{
if ( this->verify () ) {
@@ -243,24 +238,14 @@ void CASG::completionNotify ( syncGroupNotify & notify )
}
}
void CASG::recycleSyncGroupWriteNotify ( syncGroupWriteNotify &io )
void CASG::recycleSyncGroupWriteNotify ( syncGroupWriteNotify & io )
{
this->freeListWriteOP.release ( &io, sizeof ( io ) );
this->freeListWriteOP.release ( & io );
}
void CASG::recycleSyncGroupReadNotify ( syncGroupReadNotify &io )
void CASG::recycleSyncGroupReadNotify ( syncGroupReadNotify & io )
{
this->freeListReadOP.release ( &io, sizeof ( io ) );
}
void * CASG::operator new (size_t size)
{
return CASG::pFreeList->allocate ( size );
}
void CASG::operator delete (void *pCadaver, size_t size)
{
CASG::pFreeList->release ( pCadaver, size );
this->freeListReadOP.release ( & io );
}
int CASG::printf ( const char *pformat, ... )
@@ -291,5 +276,11 @@ void CASG::exception ( int status, const char *pContext,
lineNo, chan, type, count, op );
}
void CASG::operator delete ( void * pCadaver )
{
throw std::logic_error
( "compiler is confused about placement delete" );
}