usue oldCAC specific mutex

This commit is contained in:
Jeff Hill
2002-04-25 18:24:11 +00:00
parent 2e11e7aacd
commit f670103a0c
2 changed files with 38 additions and 10 deletions

View File

@@ -83,11 +83,11 @@ public:
protected:
~oldChannelNotify (); // must allocate from pool
private:
cacChannel & io;
oldCAC & cacCtx;
caCh * pConnCallBack;
void * pPrivate;
caArh * pAccessRightsFunc;
cacChannel & io;
void connectNotify ();
void disconnectNotify ();
void accessRightsNotify ( const caAccessRights & );
@@ -198,6 +198,15 @@ private:
oldSubscription & operator = ( const oldSubscription & );
};
class oldCACMutex {
public:
void lock ();
void unlock ();
void show ( unsigned level ) const;
private:
epicsMutex mutex;
};
struct oldCAC : public cacNotify
{
public:
@@ -235,7 +244,7 @@ public:
int lineno, const char *pFormat, va_list args );
bool preemptiveCallbakIsEnabled () const;
private:
mutable epicsMutex mutex;
mutable oldCACMutex mutex;
cac & clientCtx;
caExceptionHandler *ca_exception_func;
void *ca_exception_arg;
@@ -526,4 +535,19 @@ inline bool oldCAC::preemptiveCallbakIsEnabled () const
return this->clientCtx.preemptiveCallbakIsEnabled ();
}
inline void oldCACMutex::lock ()
{
this->mutex.lock ();
}
inline void oldCACMutex::unlock ()
{
this->mutex.unlock ();
}
inline void oldCACMutex::show ( unsigned level ) const
{
this->mutex.show ( level );
}
#endif // ifndef oldAccessh

View File

@@ -14,6 +14,10 @@
* 505 665 1831
*/
#ifdef _MSC_VER
# pragma warning(disable:4355)
#endif
#include <stdio.h>
#define epicsExportSharedSymbols
@@ -36,7 +40,7 @@ oldCAC::~oldCAC ()
void oldCAC::changeExceptionEvent ( caExceptionHandler *pfunc, void *arg )
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
this->ca_exception_func = pfunc;
this->ca_exception_arg = arg;
// should block here until releated callback in progress completes
@@ -44,7 +48,7 @@ void oldCAC::changeExceptionEvent ( caExceptionHandler *pfunc, void *arg )
void oldCAC::replaceErrLogHandler ( caPrintfFunc *ca_printf_func )
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
if ( ca_printf_func ) {
this->pVPrintfFunc = ca_printf_func;
}
@@ -56,7 +60,7 @@ void oldCAC::replaceErrLogHandler ( caPrintfFunc *ca_printf_func )
void oldCAC::registerForFileDescriptorCallBack ( CAFDHANDLER *pFunc, void *pArg )
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
this->fdRegFunc = pFunc;
this->fdRegArg = pArg;
// should block here until releated callback in progress completes
@@ -80,7 +84,7 @@ int oldCAC::vPrintf ( const char *pformat, va_list args ) const // X aCC 361
{
caPrintfFunc *pFunc;
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
pFunc = this->pVPrintfFunc;
}
if ( pFunc ) {
@@ -98,7 +102,7 @@ void oldCAC::exception ( int stat, const char *pCtx,
caExceptionHandler *pFunc;
void *pArg;
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
pFunc = this->ca_exception_func;
pArg = this->ca_exception_arg;
}
@@ -130,7 +134,7 @@ void oldCAC::exception ( int status, const char *pContext,
caExceptionHandler *pFunc;
void *pArg;
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
pFunc = this->ca_exception_func;
pArg = this->ca_exception_arg;
}
@@ -163,7 +167,7 @@ void oldCAC::fdWasCreated ( int fd )
CAFDHANDLER *pFunc;
void *pArg;
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
pFunc = this->fdRegFunc;
pArg = this->fdRegArg;
}
@@ -177,7 +181,7 @@ void oldCAC::fdWasDestroyed ( int fd )
CAFDHANDLER *pFunc;
void *pArg;
{
epicsGuard < epicsMutex > autoMutex ( this->mutex );
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
pFunc = this->fdRegFunc;
pArg = this->fdRegArg;
}