Experimental Physics and Industrial Control System
Jeff: this is mostly your code being modified, you might want to respond
if you object.
All: Currently C++ code that creates an epicsMutex object doesn't
provide any source code location information, even though the epicsMutex
class can save that and report it in certain error messages. I
developed the attached patch to improve that, does anyone have any
better ideas than the newEpicsMutex macro it introduces, or any other
objections to merging this patch?
- Andrew
--
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock
=== modified file 'src/libCom/osi/epicsMutex.h'
--- src/libCom/osi/epicsMutex.h 2009-01-06 17:07:56 +0000
+++ src/libCom/osi/epicsMutex.h 2013-07-08 19:09:08 +0000
@@ -23,11 +23,14 @@
#include "compilerDependencies.h"
+#define newEpicsMutex new epicsMutex(__FILE__,__LINE__)
+
class epicsShareClass epicsMutex {
public:
class mutexCreateFailed; /* exception payload */
class invalidMutex; /* exception payload */
epicsMutex ();
+ epicsMutex ( const char *pFileName, int lineno );
~epicsMutex ();
void show ( unsigned level ) const;
void lock (); /* blocks until success */
=== modified file 'src/libCom/osi/epicsMutex.cpp'
--- src/libCom/osi/epicsMutex.cpp 2012-06-22 22:32:10 +0000
+++ src/libCom/osi/epicsMutex.cpp 2013-07-08 19:00:01 +0000
@@ -226,6 +226,14 @@
}
}
+epicsMutex :: epicsMutex ( const char *pFileName, int lineno ) :
+ id ( epicsMutexOsiCreate (pFileName, lineno) )
+{
+ if ( this->id == 0 ) {
+ throw mutexCreateFailed ();
+ }
+}
+
epicsMutex ::~epicsMutex ()
{
epicsMutexDestroy ( this->id );
=== modified file 'src/ca/client/ca_client_context.cpp'
--- src/ca/client/ca_client_context.cpp 2013-06-07 23:08:38 +0000
+++ src/ca/client/ca_client_context.cpp 2013-07-08 18:58:05 +0000
@@ -57,7 +57,7 @@
{
caClientCallbackThreadId = epicsThreadPrivateCreate ();
assert ( caClientCallbackThreadId );
- ca_client_context::pDefaultServiceInstallMutex = new epicsMutex;
+ ca_client_context::pDefaultServiceInstallMutex = newEpicsMutex;
epicsAtExit ( cacExitHandler,0 );
}
=== modified file 'src/ca/legacy/gdd/gdd.cc'
--- src/ca/legacy/gdd/gdd.cc 2011-11-29 22:14:19 +0000
+++ src/ca/legacy/gdd/gdd.cc 2013-07-08 18:57:59 +0000
@@ -79,7 +79,7 @@
extern "C" void gddStaticInit ( void * p )
{
epicsMutex * * pMutex = static_cast < epicsMutex * * > ( p );
- *pMutex = new epicsMutex ();
+ *pMutex = newEpicsMutex;
}
gdd::gdd(int app, aitEnum prim, int dimen)
=== modified file 'src/ca/legacy/gdd/gddNewDel.h'
--- src/ca/legacy/gdd/gddNewDel.h 2010-10-05 19:27:37 +0000
+++ src/ca/legacy/gdd/gddNewDel.h 2013-07-08 19:06:27 +0000
@@ -64,7 +64,7 @@
char** x = (char**)pfld; return *x; } \
void newdel_setNext(char* n) { char* pfld = (char *)&fld; \
char** x=(char**)pfld; *x=n; } \
- static void gddNewDelInit (void) { pNewdel_lock = new epicsMutex; }
+ static void gddNewDelInit (void) { pNewdel_lock = newEpicsMutex; }
// declaration of the static variable for the free list
=== modified file 'src/libCom/cxxTemplates/epicsSingletonBase.cpp'
--- src/libCom/cxxTemplates/epicsSingletonBase.cpp 2010-10-05 19:27:37 +0000
+++ src/libCom/cxxTemplates/epicsSingletonBase.cpp 2013-07-08 18:57:20 +0000
@@ -33,7 +33,7 @@
static void epicsSingletonOnce ( void * )
{
- pSingletonBaseMutexEPICS = new epicsMutex;
+ pSingletonBaseMutexEPICS = newEpicsMutex;
epicsAtExit ( epicsSingletonCleanup,0 );
}
=== modified file 'src/libCom/cxxTemplates/epicsSingletonMutex.cpp'
--- src/libCom/cxxTemplates/epicsSingletonMutex.cpp 2010-10-05 19:27:37 +0000
+++ src/libCom/cxxTemplates/epicsSingletonMutex.cpp 2013-07-08 19:06:07 +0000
@@ -35,7 +35,7 @@
// This class exists for the purpose of avoiding file scope
// object chicken and egg problems. Therefore, pEPICSSigletonMutex
// is never destroyed.
- pEPICSSigletonMutex = new epicsMutex;
+ pEPICSSigletonMutex = newEpicsMutex;
}
void SingletonUntyped :: incrRefCount ( PBuild pBuild )
=== modified file 'src/libCom/misc/ipAddrToAsciiAsynchronous.cpp'
--- src/libCom/misc/ipAddrToAsciiAsynchronous.cpp 2012-04-12 16:28:23 +0000
+++ src/libCom/misc/ipAddrToAsciiAsynchronous.cpp 2013-07-08 19:06:20 +0000
@@ -155,7 +155,7 @@
static void ipAddrToAsciiEngineGlobalMutexConstruct ( void * )
{
- ipAddrToAsciiEnginePrivate :: pGlobalMutex = new epicsMutex ();
+ ipAddrToAsciiEnginePrivate :: pGlobalMutex = newEpicsMutex;
epicsAtExit ( ipAddrToAsciiEngineShutdownRequest, 0 );
}
- Navigate by Date:
- Prev:
Re: Build problem with 3.15-head Andrew Johnson
- Next:
Re: [Merge] lp:~epics-core/epics-base/ioc-shutdown into lp:epics-base Ralph Lange
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
casStrmClient.cc memory leak fix Hill, Jeff
- Next:
[Merge] lp:~epics-core/epics-base/parallel-cbthreads-2 into lp:epics-base Ralph Lange
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024