free list use epicsSingleton

This commit is contained in:
Jeff Hill
2002-03-22 00:04:24 +00:00
parent d9d84a5695
commit 6129da9fb5
7 changed files with 21 additions and 12 deletions

View File

@@ -66,7 +66,7 @@ private:
unsigned long count;
unsigned id;
dbSubscriptionIO * isSubscription ();
static epicsSingleton < tsFreeList < dbSubscriptionIO > > freeList;
static epicsSingleton < tsFreeList < dbSubscriptionIO > > pFreeList;
friend void dbSubscriptionEventCallback ( void *pPrivate, struct dbAddr *paddr,
int eventsRemaining, struct db_field_log *pfl );
dbSubscriptionIO ( const dbSubscriptionIO & );
@@ -117,7 +117,7 @@ private:
void ioShow ( const ioid &, unsigned level ) const;
short nativeType () const;
unsigned long nativeElementCount () const;
static epicsSingleton < tsFreeList < dbChannelIO > > freeList;
static epicsSingleton < tsFreeList < dbChannelIO > > pFreeList;
static unsigned nextIdForIO;
dbChannelIO ( const dbChannelIO & );
dbChannelIO & operator = ( const dbChannelIO & );

View File

@@ -21,6 +21,7 @@
#include "tsFreeList.h"
#include "epicsMutex.h"
#include "epicsEvent.h"
#include "epicsSingleton.h"
#include "db_access.h"
#define epicsExportSharedSymbols
@@ -29,7 +30,7 @@
#include "dbChannelIOIL.h"
#include "dbPutNotifyBlocker.h"
tsFreeList < dbChannelIO > dbChannelIO::freeList;
epicsSingleton < tsFreeList < dbChannelIO > > dbChannelIO::pFreeList;
unsigned dbChannelIO::nextIdForIO;
dbChannelIO::dbChannelIO ( cacChannelNotify &notify,

View File

@@ -32,12 +32,12 @@ inline void dbChannelIO::destroy ()
inline void * dbChannelIO::operator new ( size_t size )
{
return dbChannelIO::freeList.allocate ( size );
return dbChannelIO::pFreeList->allocate ( size );
}
inline void dbChannelIO::operator delete ( void *pCadaver, size_t size )
{
dbChannelIO::freeList.release ( pCadaver, size );
dbChannelIO::pFreeList->release ( pCadaver, size );
}
inline const char *dbChannelIO::pName () const

View File

@@ -23,6 +23,7 @@
#include "epicsEvent.h"
#include "epicsTime.h"
#include "tsFreeList.h"
#include "epicsSingleton.h"
#include "errMdef.h"
#include "cacIO.h"
@@ -34,7 +35,7 @@
#include "dbChannelIOIL.h"
#include "dbPutNotifyBlocker.h"
tsFreeList < dbPutNotifyBlocker, 1024, 0 > dbPutNotifyBlocker::freeList;
epicsSingleton < tsFreeList < dbPutNotifyBlocker, 1024 > > dbPutNotifyBlocker::pFreeList;
dbPutNotifyBlocker::dbPutNotifyBlocker ( dbChannelIO &chanIn ) :
pNotify ( 0 )

View File

@@ -36,7 +36,7 @@ private:
epicsEvent block;
cacWriteNotify * pNotify;
dbSubscriptionIO * isSubscription ();
static epicsSingleton < tsFreeList < dbPutNotifyBlocker > > freeList;
static epicsSingleton < tsFreeList < dbPutNotifyBlocker > > pFreeList;
friend void putNotifyCompletion ( putNotify *ppn );
dbPutNotifyBlocker ( const dbPutNotifyBlocker & );
dbPutNotifyBlocker & operator = ( const dbPutNotifyBlocker & );
@@ -44,12 +44,12 @@ private:
inline void * dbPutNotifyBlocker::operator new ( size_t size )
{
return dbPutNotifyBlocker::freeList.allocate ( size );
return dbPutNotifyBlocker::pFreeList->allocate ( size );
}
inline void dbPutNotifyBlocker::operator delete ( void *pCadaver, size_t size )
{
dbPutNotifyBlocker::freeList.release ( pCadaver, size );
dbPutNotifyBlocker::pFreeList->release ( pCadaver, size );
}
#endif // ifndef dbPutNotifyBlockerh

View File

@@ -1,6 +1,12 @@
/*
* $Id$
* Auther Jeff Hill
*/
#include "epicsMutex.h"
#include "tsFreeList.h"
#include "epicsSingleton.h"
#include "cacIO.h"
#include "cadef.h" // this can be eliminated when the callbacks use the new interface

View File

@@ -20,6 +20,7 @@
#include "epicsMutex.h"
#include "epicsEvent.h"
#include "tsFreeList.h"
#include "epicsSingleton.h"
#include "cacIO.h"
#include "db_access.h" // need to eliminate this
@@ -30,7 +31,7 @@
#include "dbChannelIOIL.h"
#include "db_access_routines.h"
tsFreeList < dbSubscriptionIO > dbSubscriptionIO::freeList;
epicsSingleton < tsFreeList < dbSubscriptionIO > > dbSubscriptionIO::pFreeList;
dbSubscriptionIO::dbSubscriptionIO ( dbServiceIO &serviceIO, dbChannelIO &chanIO,
dbAddr &addr, cacStateNotify &notifyIn,
@@ -79,12 +80,12 @@ void dbSubscriptionIO::channelDeleteException ()
void * dbSubscriptionIO::operator new ( size_t size )
{
return dbSubscriptionIO::freeList.allocate ( size );
return dbSubscriptionIO::pFreeList->allocate ( size );
}
void dbSubscriptionIO::operator delete ( void *pCadaver, size_t size )
{
dbSubscriptionIO::freeList.release ( pCadaver, size );
dbSubscriptionIO::pFreeList->release ( pCadaver, size );
}
extern "C" void dbSubscriptionEventCallback ( void *pPrivate, struct dbAddr * /* paddr */,