From 0a93c81e2cae78ff64ff77db86e94de92ef09df7 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 5 Feb 2004 01:16:02 +0000 Subject: [PATCH] fixed gnu warnings --- src/gdd/gdd.cc | 34 ++++++++++++++++------------------ src/gdd/gdd.h | 11 ++--------- 2 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/gdd/gdd.cc b/src/gdd/gdd.cc index 6233e8136..211abdf13 100644 --- a/src/gdd/gdd.cc +++ b/src/gdd/gdd.cc @@ -27,20 +27,9 @@ gdd_NEWDEL_NEW(gdd) gdd_NEWDEL_DEL(gdd) gdd_NEWDEL_STAT(gdd) -epicsMutex * gdd::pGlobalMutex = 0; -epicsThreadOnceId gdd::staticInitOnce = EPICS_THREAD_ONCE_INIT; +epicsMutex * gdd::pGlobalMutex; -// Can't pass C++ linkage static member function gdd::staticInit -// into epicsThreadOnce(); we need a C linkage function for that: -extern "C" { - static void gdd_staticInit(void *) { gdd::staticInit(); } -} - -void gdd::staticInit (void) -{ - gdd::pGlobalMutex = new epicsMutex; - assert ( gdd::pGlobalMutex ); -} +static epicsThreadOnceId gddOnce = EPICS_THREAD_ONCE_INIT; class gddFlattenDestructor : public gddDestructor { @@ -87,22 +76,31 @@ class gddAitStringDestructor: public gddDestructor { // --------------------------The gdd functions------------------------- +static void gddStaticInit ( void * p ) +{ + epicsMutex * * pMutex = static_cast < epicsMutex * * > ( p ); + *pMutex = new epicsMutex (); +} + +gdd::staticInit () +{ + epicsThreadOnce ( & gddOnce, gddStaticInit, & gdd::pGlobalMutex ); +} + gdd::gdd(int app, aitEnum prim, int dimen) { init(app,prim,dimen); } -gdd::gdd(int app, aitEnum prim, int dimen, aitUint32* val) +gdd::gdd(int app, aitEnum prim, int dimen, aitUint32* val) { - int i; init(app,prim,dimen); - for(i=0;i0=array gdd_NEWDEL_DATA // required for using generic new and remove + private: mutable aitUint32 ref_cnt; aitUint8 flags; static epicsMutex * pGlobalMutex; - static epicsThreadOnceId staticInitOnce; - static void staticInit (void); -friend void gdd_staticInit(void *); - + static staticInit (); const gdd* indexDD (aitIndex index) const; }; - // include these to be backward compatible with first gdd library version #include "gddArray.h" #include "gddScalar.h"