changed the name of class oldCAC to ca_client_context
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@
|
||||
|
||||
epicsSingleton < tsFreeList < struct CASG, 128 > > CASG::pFreeList;
|
||||
|
||||
CASG::CASG ( oldCAC &cacIn ) :
|
||||
CASG::CASG ( ca_client_context &cacIn ) :
|
||||
client ( cacIn ), magic ( CASG_MAGIC )
|
||||
{
|
||||
client.installCASG ( *this );
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ LIBSRCS += netSubscription.cpp
|
||||
LIBSRCS += tcpSendWatchdog.cpp
|
||||
LIBSRCS += tcpRecvWatchdog.cpp
|
||||
LIBSRCS += bhe.cpp
|
||||
LIBSRCS += oldCAC.cpp
|
||||
LIBSRCS += ca_client_context.cpp
|
||||
LIBSRCS += oldChannelNotify.cpp
|
||||
LIBSRCS += oldSubscription.cpp
|
||||
LIBSRCS += getCallback.cpp
|
||||
|
||||
+29
-29
@@ -57,7 +57,7 @@ extern "C" void ca_init_client_context ( void * )
|
||||
/*
|
||||
* fetchClientContext ();
|
||||
*/
|
||||
int fetchClientContext ( oldCAC **ppcac )
|
||||
int fetchClientContext ( ca_client_context **ppcac )
|
||||
{
|
||||
if ( caClientContextId == 0 ) {
|
||||
epicsThreadOnce ( &caClientContextIdOnce, ca_init_client_context, 0 );
|
||||
@@ -67,14 +67,14 @@ int fetchClientContext ( oldCAC **ppcac )
|
||||
}
|
||||
|
||||
int status;
|
||||
*ppcac = ( oldCAC * ) epicsThreadPrivateGet ( caClientContextId );
|
||||
*ppcac = ( ca_client_context * ) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( *ppcac ) {
|
||||
status = ECA_NORMAL;
|
||||
}
|
||||
else {
|
||||
status = ca_task_initialize ();
|
||||
if ( status == ECA_NORMAL ) {
|
||||
*ppcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
|
||||
*ppcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( ! *ppcac ) {
|
||||
status = ECA_INTERNAL;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ int epicsShareAPI ca_task_initialize ( void )
|
||||
int epicsShareAPI ca_context_create (
|
||||
ca_preemptive_callback_select premptiveCallbackSelect )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
|
||||
try {
|
||||
epicsThreadOnce ( &caClientContextIdOnce, ca_init_client_context, 0);
|
||||
@@ -105,14 +105,14 @@ int epicsShareAPI ca_context_create (
|
||||
return ECA_ALLOCMEM;
|
||||
}
|
||||
|
||||
pcac = ( oldCAC * ) epicsThreadPrivateGet ( caClientContextId );
|
||||
pcac = ( ca_client_context * ) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( pcac ) {
|
||||
return ECA_NORMAL;
|
||||
}
|
||||
|
||||
bool enablePreemptiveCallback =
|
||||
premptiveCallbackSelect == ca_enable_preemptive_callback;
|
||||
pcac = new oldCAC ( enablePreemptiveCallback );
|
||||
pcac = new ca_client_context ( enablePreemptiveCallback );
|
||||
if ( ! pcac ) {
|
||||
return ECA_ALLOCMEM;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ int epicsShareAPI ca_context_create (
|
||||
//
|
||||
int epicsShareAPI ca_register_service ( cacService *pService )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext (&pcac);
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -169,10 +169,10 @@ int epicsShareAPI ca_modify_user_name ( const char * )
|
||||
// extern "C"
|
||||
void epicsShareAPI ca_context_destroy ()
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
|
||||
if ( caClientContextId != NULL ) {
|
||||
pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
|
||||
pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( pcac ) {
|
||||
delete pcac;
|
||||
epicsThreadPrivateSet ( caClientContextId, 0 );
|
||||
@@ -227,7 +227,7 @@ int epicsShareAPI ca_create_channel (
|
||||
const char *name_str, caCh * conn_func, void * puser,
|
||||
capri priority, chid * chanptr )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -274,7 +274,7 @@ int epicsShareAPI ca_clear_channel ( chid pChan )
|
||||
int epicsShareAPI ca_array_get ( chtype type,
|
||||
arrayElementCount count, chid pChan, void *pValue )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -549,7 +549,7 @@ int epicsShareAPI ca_replace_access_rights_event ( chid pChan, caArh *pfunc )
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_add_exception_event ( caExceptionHandler *pfunc, void *arg )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -675,7 +675,7 @@ int epicsShareAPI ca_pend ( ca_real timeout, int early ) // X aCC 361
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_pend_event ( ca_real timeout )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int status = fetchClientContext ( &pcac );
|
||||
if ( status != ECA_NORMAL ) {
|
||||
return status;
|
||||
@@ -702,7 +702,7 @@ int epicsShareAPI ca_pend_event ( ca_real timeout )
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_pend_io ( ca_real timeout )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int status = fetchClientContext ( &pcac );
|
||||
if ( status != ECA_NORMAL ) {
|
||||
return status;
|
||||
@@ -728,7 +728,7 @@ int epicsShareAPI ca_pend_io ( ca_real timeout )
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_flush_io ()
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext (&pcac);
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -745,7 +745,7 @@ int epicsShareAPI ca_flush_io ()
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_test_io () // X aCC 361
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -807,10 +807,10 @@ void epicsShareAPI ca_signal_with_file_and_lineno ( long ca_status,
|
||||
void epicsShareAPI ca_signal_formated ( long ca_status, const char *pfilenm,
|
||||
int lineno, const char *pFormat, ... )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
|
||||
if ( caClientContextId ) {
|
||||
pcac = ( oldCAC * ) epicsThreadPrivateGet ( caClientContextId );
|
||||
pcac = ( ca_client_context * ) epicsThreadPrivateGet ( caClientContextId );
|
||||
}
|
||||
else {
|
||||
pcac = 0;
|
||||
@@ -840,7 +840,7 @@ void epicsShareAPI ca_signal_formated ( long ca_status, const char *pfilenm,
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_add_fd_registration (CAFDHANDLER *func, void *arg)
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -894,7 +894,7 @@ const char * epicsShareAPI ca_version ()
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_replace_printf_handler ( caPrintfFunc *ca_printf_func )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext (&pcac);
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -1006,7 +1006,7 @@ double epicsShareAPI ca_beacon_period ( chid pChan )
|
||||
// extern "C"
|
||||
unsigned epicsShareAPI ca_get_ioc_connection_count ()
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -1026,7 +1026,7 @@ int epicsShareAPI ca_channel_status ( epicsThreadId /* tid */ )
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_client_status ( unsigned level )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus = fetchClientContext ( &pcac );
|
||||
if ( caStatus != ECA_NORMAL ) {
|
||||
return caStatus;
|
||||
@@ -1049,11 +1049,11 @@ int epicsShareAPI ca_context_status ( ca_client_context * pcac, unsigned level )
|
||||
* by another thread
|
||||
*/
|
||||
// extern "C"
|
||||
struct oldCAC * epicsShareAPI ca_current_context ()
|
||||
struct ca_client_context * epicsShareAPI ca_current_context ()
|
||||
{
|
||||
struct oldCAC *pCtx;
|
||||
struct ca_client_context *pCtx;
|
||||
if ( caClientContextId ) {
|
||||
pCtx = ( struct oldCAC * )
|
||||
pCtx = ( struct ca_client_context * )
|
||||
epicsThreadPrivateGet ( caClientContextId );
|
||||
}
|
||||
else {
|
||||
@@ -1069,9 +1069,9 @@ struct oldCAC * epicsShareAPI ca_current_context ()
|
||||
* by another thread
|
||||
*/
|
||||
// extern "C"
|
||||
int epicsShareAPI ca_attach_context ( struct oldCAC * pCtx )
|
||||
int epicsShareAPI ca_attach_context ( struct ca_client_context * pCtx )
|
||||
{
|
||||
oldCAC *pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
|
||||
ca_client_context *pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( pcac && pCtx != 0 ) {
|
||||
return ECA_ISATTACHED;
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ int epicsShareAPI ca_attach_context ( struct oldCAC * pCtx )
|
||||
|
||||
int epicsShareAPI ca_preemtive_callback_is_enabled ()
|
||||
{
|
||||
oldCAC *pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
|
||||
ca_client_context *pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( ! pcac ) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1095,7 +1095,7 @@ int epicsShareAPI ca_preemtive_callback_is_enabled ()
|
||||
// extern "C"
|
||||
void epicsShareAPI ca_self_test ()
|
||||
{
|
||||
oldCAC *pcac = (oldCAC *) epicsThreadPrivateGet ( caClientContextId );
|
||||
ca_client_context *pcac = (ca_client_context *) epicsThreadPrivateGet ( caClientContextId );
|
||||
if ( ! pcac ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
extern epicsThreadPrivateId caClientContextId;
|
||||
|
||||
oldCAC::oldCAC ( bool enablePreemptiveCallback ) :
|
||||
ca_client_context::ca_client_context ( bool enablePreemptiveCallback ) :
|
||||
clientCtx ( * new cac ( *this, enablePreemptiveCallback ) ),
|
||||
pCallbackGuard ( 0 ), ca_exception_func ( 0 ), ca_exception_arg ( 0 ),
|
||||
pVPrintfFunc ( errlogVprintf ), fdRegFunc ( 0 ), fdRegArg ( 0 ),
|
||||
@@ -40,23 +40,23 @@ oldCAC::oldCAC ( bool enablePreemptiveCallback ) :
|
||||
}
|
||||
}
|
||||
|
||||
oldCAC::~oldCAC ()
|
||||
ca_client_context::~ca_client_context ()
|
||||
{
|
||||
delete this->pCallbackGuard;
|
||||
delete & this->clientCtx;
|
||||
}
|
||||
|
||||
void oldCAC::changeExceptionEvent ( caExceptionHandler *pfunc, void *arg )
|
||||
void ca_client_context::changeExceptionEvent ( caExceptionHandler *pfunc, void *arg )
|
||||
{
|
||||
epicsGuard < oldCACMutex > guard ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > guard ( this->mutex );
|
||||
this->ca_exception_func = pfunc;
|
||||
this->ca_exception_arg = arg;
|
||||
// should block here until releated callback in progress completes
|
||||
}
|
||||
|
||||
void oldCAC::replaceErrLogHandler ( caPrintfFunc *ca_printf_func )
|
||||
void ca_client_context::replaceErrLogHandler ( caPrintfFunc *ca_printf_func )
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
if ( ca_printf_func ) {
|
||||
this->pVPrintfFunc = ca_printf_func;
|
||||
}
|
||||
@@ -66,33 +66,33 @@ void oldCAC::replaceErrLogHandler ( caPrintfFunc *ca_printf_func )
|
||||
// should block here until releated callback in progress completes
|
||||
}
|
||||
|
||||
void oldCAC::registerForFileDescriptorCallBack ( CAFDHANDLER *pFunc, void *pArg )
|
||||
void ca_client_context::registerForFileDescriptorCallBack ( CAFDHANDLER *pFunc, void *pArg )
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
this->fdRegFunc = pFunc;
|
||||
this->fdRegArg = pArg;
|
||||
// should block here until releated callback in progress completes
|
||||
}
|
||||
|
||||
int oldCAC::printf ( const char *pformat, ... ) const
|
||||
int ca_client_context::printf ( const char *pformat, ... ) const
|
||||
{
|
||||
va_list theArgs;
|
||||
int status;
|
||||
|
||||
va_start ( theArgs, pformat );
|
||||
|
||||
status = this->oldCAC::vPrintf ( pformat, theArgs );
|
||||
status = this->ca_client_context::vPrintf ( pformat, theArgs );
|
||||
|
||||
va_end ( theArgs );
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int oldCAC::vPrintf ( const char *pformat, va_list args ) const // X aCC 361
|
||||
int ca_client_context::vPrintf ( const char *pformat, va_list args ) const // X aCC 361
|
||||
{
|
||||
caPrintfFunc *pFunc;
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
pFunc = this->pVPrintfFunc;
|
||||
}
|
||||
if ( pFunc ) {
|
||||
@@ -103,14 +103,14 @@ int oldCAC::vPrintf ( const char *pformat, va_list args ) const // X aCC 361
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::exception ( int stat, const char *pCtx,
|
||||
void ca_client_context::exception ( int stat, const char *pCtx,
|
||||
const char *pFile, unsigned lineNo )
|
||||
{
|
||||
struct exception_handler_args args;
|
||||
caExceptionHandler *pFunc;
|
||||
void *pArg;
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
pFunc = this->ca_exception_func;
|
||||
pArg = this->ca_exception_arg;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ void oldCAC::exception ( int stat, const char *pCtx,
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::exception ( int status, const char *pContext,
|
||||
void ca_client_context::exception ( int status, const char *pContext,
|
||||
const char *pFileName, unsigned lineNo, oldChannelNotify &chan,
|
||||
unsigned type, arrayElementCount count, unsigned op )
|
||||
{
|
||||
@@ -142,7 +142,7 @@ void oldCAC::exception ( int status, const char *pContext,
|
||||
caExceptionHandler *pFunc;
|
||||
void *pArg;
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
pFunc = this->ca_exception_func;
|
||||
pArg = this->ca_exception_arg;
|
||||
}
|
||||
@@ -170,12 +170,12 @@ void oldCAC::exception ( int status, const char *pContext,
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::fdWasCreated ( int fd )
|
||||
void ca_client_context::fdWasCreated ( int fd )
|
||||
{
|
||||
CAFDHANDLER *pFunc;
|
||||
void *pArg;
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
pFunc = this->fdRegFunc;
|
||||
pArg = this->fdRegArg;
|
||||
}
|
||||
@@ -184,12 +184,12 @@ void oldCAC::fdWasCreated ( int fd )
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::fdWasDestroyed ( int fd )
|
||||
void ca_client_context::fdWasDestroyed ( int fd )
|
||||
{
|
||||
CAFDHANDLER *pFunc;
|
||||
void *pArg;
|
||||
{
|
||||
epicsGuard < oldCACMutex > autoMutex ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > autoMutex ( this->mutex );
|
||||
pFunc = this->fdRegFunc;
|
||||
pArg = this->fdRegArg;
|
||||
}
|
||||
@@ -198,9 +198,9 @@ void oldCAC::fdWasDestroyed ( int fd )
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::show ( unsigned level ) const
|
||||
void ca_client_context::show ( unsigned level ) const
|
||||
{
|
||||
::printf ( "oldCAC at %p\n",
|
||||
::printf ( "ca_client_context at %p\n",
|
||||
static_cast <const void *> ( this ) );
|
||||
if ( level > 0u ) {
|
||||
this->mutex.show ( level - 1u );
|
||||
@@ -217,16 +217,16 @@ void oldCAC::show ( unsigned level ) const
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::attachToClientCtx ()
|
||||
void ca_client_context::attachToClientCtx ()
|
||||
{
|
||||
assert ( ! epicsThreadPrivateGet ( caClientContextId ) );
|
||||
epicsThreadPrivateSet ( caClientContextId, this );
|
||||
}
|
||||
|
||||
void oldCAC::incrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
void ca_client_context::incrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
{
|
||||
if ( this->ioSeqNo == ioSeqNoIn ) {
|
||||
epicsGuard < oldCACMutex > guard ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > guard ( this->mutex );
|
||||
if ( this->ioSeqNo == ioSeqNoIn ) {
|
||||
assert ( this->pndRecvCnt < UINT_MAX );
|
||||
this->pndRecvCnt++;
|
||||
@@ -234,7 +234,7 @@ void oldCAC::incrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
}
|
||||
}
|
||||
|
||||
void oldCAC::decrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
void ca_client_context::decrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
{
|
||||
if ( this->ioSeqNo != ioSeqNoIn ) {
|
||||
return;
|
||||
@@ -242,7 +242,7 @@ void oldCAC::decrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
|
||||
bool signalNeeded;
|
||||
{
|
||||
epicsGuard < oldCACMutex > guard ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > guard ( this->mutex );
|
||||
if ( this->ioSeqNo == ioSeqNoIn ) {
|
||||
assert ( this->pndRecvCnt > 0u );
|
||||
this->pndRecvCnt--;
|
||||
@@ -269,7 +269,7 @@ void oldCAC::decrementOutstandingIO ( unsigned ioSeqNoIn )
|
||||
// !!!! is disabled. This prevents the preemptive callback lock from being released
|
||||
// !!!! by other threads than the one that locked it.
|
||||
//
|
||||
int oldCAC::pendIO ( const double & timeout )
|
||||
int ca_client_context::pendIO ( const double & timeout )
|
||||
{
|
||||
// prevent recursion nightmares by disabling calls to
|
||||
// pendIO () from within a CA callback.
|
||||
@@ -301,7 +301,7 @@ int oldCAC::pendIO ( const double & timeout )
|
||||
}
|
||||
|
||||
{
|
||||
epicsGuard < oldCACMutex > guard ( this->mutex );
|
||||
epicsGuard < ca_client_context_mutex > guard ( this->mutex );
|
||||
this->ioSeqNo++;
|
||||
this->pndRecvCnt = 0u;
|
||||
}
|
||||
@@ -315,8 +315,7 @@ int oldCAC::pendIO ( const double & timeout )
|
||||
// !!!! is disabled. This prevents the preemptive callback lock from being released
|
||||
// !!!! by other threads than the one that locked it.
|
||||
//
|
||||
// this routine should probably be moved to the oldCAC?
|
||||
int oldCAC::pendEvent ( const double & timeout )
|
||||
int ca_client_context::pendEvent ( const double & timeout )
|
||||
{
|
||||
// prevent recursion nightmares by disabling calls to
|
||||
// pendIO () from within a CA callback.
|
||||
@@ -357,7 +356,7 @@ int oldCAC::pendEvent ( const double & timeout )
|
||||
return ECA_TIMEOUT;
|
||||
}
|
||||
|
||||
void oldCAC::blockForEventAndEnableCallbacks ( epicsEvent & event, double timeout )
|
||||
void ca_client_context::blockForEventAndEnableCallbacks ( epicsEvent & event, double timeout )
|
||||
{
|
||||
if ( this->pCallbackGuard ) {
|
||||
epicsGuardRelease < callbackMutex > unguard ( *this->pCallbackGuard );
|
||||
+3
-4
@@ -924,13 +924,12 @@ epicsShareFunc int epicsShareAPI ca_preemtive_callback_is_enabled ();
|
||||
* used when an auxillary thread needs to join a CA client context started
|
||||
* by another thread
|
||||
*/
|
||||
typedef struct oldCAC ca_client_context;
|
||||
epicsShareFunc ca_client_context * epicsShareAPI ca_current_context ();
|
||||
epicsShareFunc int epicsShareAPI ca_attach_context ( ca_client_context * context );
|
||||
epicsShareFunc struct ca_client_context * epicsShareAPI ca_current_context ();
|
||||
epicsShareFunc int epicsShareAPI ca_attach_context ( struct ca_client_context * context );
|
||||
|
||||
|
||||
epicsShareFunc int epicsShareAPI ca_client_status ( unsigned level );
|
||||
epicsShareFunc int epicsShareAPI ca_context_status ( ca_client_context *, unsigned level );
|
||||
epicsShareFunc int epicsShareAPI ca_context_status ( struct ca_client_context *, unsigned level );
|
||||
|
||||
epicsShareFunc void epicsShareAPI ca_self_test ();
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
epicsSingleton < tsFreeList < class getCopy, 1024 > > getCopy::pFreeList;
|
||||
|
||||
getCopy::getCopy ( oldCAC &cacCtxIn, oldChannelNotify &chanIn,
|
||||
getCopy::getCopy ( ca_client_context &cacCtxIn, oldChannelNotify &chanIn,
|
||||
unsigned typeIn, arrayElementCount countIn, void *pValueIn ) :
|
||||
count ( countIn ), cacCtx ( cacCtxIn ), chan ( chanIn ), pValue ( pValueIn ),
|
||||
ioSeqNo ( cacCtxIn.sequenceNumberOfOutstandingIO () ), type ( typeIn )
|
||||
|
||||
+28
-28
@@ -39,7 +39,7 @@
|
||||
|
||||
struct oldChannelNotify : public cacChannelNotify {
|
||||
public:
|
||||
oldChannelNotify ( struct oldCAC &, const char *pName,
|
||||
oldChannelNotify ( struct ca_client_context &, const char *pName,
|
||||
caCh *pConnCallBackIn, void *pPrivateIn, capri priority );
|
||||
void destroy ();
|
||||
void setPrivatePointer ( void * );
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
protected:
|
||||
~oldChannelNotify (); // must allocate from pool
|
||||
private:
|
||||
oldCAC & cacCtx;
|
||||
ca_client_context & cacCtx;
|
||||
cacChannel & io;
|
||||
caCh * pConnCallBack;
|
||||
void * pPrivate;
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
|
||||
class getCopy : public cacReadNotify {
|
||||
public:
|
||||
getCopy ( oldCAC &cacCtx, oldChannelNotify &, unsigned type,
|
||||
getCopy ( ca_client_context &cacCtx, oldChannelNotify &, unsigned type,
|
||||
arrayElementCount count, void *pValue );
|
||||
void destroy ();
|
||||
void show ( unsigned level ) const;
|
||||
@@ -117,7 +117,7 @@ protected:
|
||||
~getCopy (); // allocate only out of pool
|
||||
private:
|
||||
arrayElementCount count;
|
||||
oldCAC &cacCtx;
|
||||
ca_client_context &cacCtx;
|
||||
oldChannelNotify &chan;
|
||||
void *pValue;
|
||||
unsigned ioSeqNo;
|
||||
@@ -200,7 +200,7 @@ private:
|
||||
oldSubscription & operator = ( const oldSubscription & );
|
||||
};
|
||||
|
||||
class oldCACMutex {
|
||||
class ca_client_context_mutex {
|
||||
public:
|
||||
void lock ();
|
||||
void unlock ();
|
||||
@@ -209,11 +209,11 @@ private:
|
||||
epicsMutex mutex;
|
||||
};
|
||||
|
||||
struct oldCAC : public cacNotify
|
||||
struct ca_client_context : public cacNotify
|
||||
{
|
||||
public:
|
||||
oldCAC ( bool enablePreemptiveCallback = false );
|
||||
virtual ~oldCAC ();
|
||||
ca_client_context ( bool enablePreemptiveCallback = false );
|
||||
virtual ~ca_client_context ();
|
||||
void changeExceptionEvent ( caExceptionHandler * pfunc, void * arg );
|
||||
void registerForFileDescriptorCallBack ( CAFDHANDLER * pFunc, void * pArg );
|
||||
void replaceErrLogHandler ( caPrintfFunc * ca_printf_func );
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
bool preemptiveCallbakIsEnabled () const;
|
||||
epicsGuard < callbackMutex > callbackGuardFactory ();
|
||||
private:
|
||||
mutable oldCACMutex mutex;
|
||||
mutable ca_client_context_mutex mutex;
|
||||
epicsEvent ioDone;
|
||||
cac & clientCtx;
|
||||
epicsGuard < callbackMutex > * pCallbackGuard;
|
||||
@@ -262,11 +262,11 @@ private:
|
||||
void fdWasCreated ( int fd );
|
||||
void fdWasDestroyed ( int fd );
|
||||
void attachToClientCtx ();
|
||||
oldCAC ( const oldCAC & );
|
||||
oldCAC & operator = ( const oldCAC & );
|
||||
ca_client_context ( const ca_client_context & );
|
||||
ca_client_context & operator = ( const ca_client_context & );
|
||||
};
|
||||
|
||||
int fetchClientContext ( oldCAC **ppcac );
|
||||
int fetchClientContext ( ca_client_context **ppcac );
|
||||
|
||||
inline void oldChannelNotify::destroy ()
|
||||
{
|
||||
@@ -453,85 +453,85 @@ inline void getCallback::operator delete ( void *pCadaver, size_t size )
|
||||
getCallback::pFreeList->release ( pCadaver, size );
|
||||
}
|
||||
|
||||
inline void oldCAC::registerService ( cacService &service )
|
||||
inline void ca_client_context::registerService ( cacService &service )
|
||||
{
|
||||
this->clientCtx.registerService ( service );
|
||||
}
|
||||
|
||||
inline cacChannel & oldCAC::createChannel ( const char * name_str,
|
||||
inline cacChannel & ca_client_context::createChannel ( const char * name_str,
|
||||
oldChannelNotify & chan, cacChannel::priLev pri )
|
||||
{
|
||||
return this->clientCtx.createChannel ( name_str, chan, pri );
|
||||
}
|
||||
|
||||
inline void oldCAC::flushRequest ()
|
||||
inline void ca_client_context::flushRequest ()
|
||||
{
|
||||
this->clientCtx.flushRequest ();
|
||||
}
|
||||
|
||||
inline unsigned oldCAC::connectionCount () const
|
||||
inline unsigned ca_client_context::connectionCount () const
|
||||
{
|
||||
return this->clientCtx.connectionCount ();
|
||||
}
|
||||
|
||||
inline CASG * oldCAC::lookupCASG ( unsigned id )
|
||||
inline CASG * ca_client_context::lookupCASG ( unsigned id )
|
||||
{
|
||||
return this->clientCtx.lookupCASG ( id );
|
||||
}
|
||||
|
||||
inline void oldCAC::installCASG ( CASG &sg )
|
||||
inline void ca_client_context::installCASG ( CASG &sg )
|
||||
{
|
||||
this->clientCtx.installCASG ( sg );
|
||||
}
|
||||
|
||||
inline void oldCAC::uninstallCASG ( CASG &sg )
|
||||
inline void ca_client_context::uninstallCASG ( CASG &sg )
|
||||
{
|
||||
this->clientCtx.uninstallCASG ( sg );
|
||||
}
|
||||
|
||||
inline void oldCAC::vSignal ( int ca_status, const char *pfilenm,
|
||||
inline void ca_client_context::vSignal ( int ca_status, const char *pfilenm,
|
||||
int lineno, const char *pFormat, va_list args )
|
||||
{
|
||||
this->clientCtx.vSignal ( ca_status, pfilenm,
|
||||
lineno, pFormat, args );
|
||||
}
|
||||
|
||||
inline void oldCAC::selfTest ()
|
||||
inline void ca_client_context::selfTest ()
|
||||
{
|
||||
this->clientCtx.selfTest ();
|
||||
}
|
||||
|
||||
inline bool oldCAC::preemptiveCallbakIsEnabled () const
|
||||
inline bool ca_client_context::preemptiveCallbakIsEnabled () const
|
||||
{
|
||||
return this->clientCtx.preemptiveCallbakIsEnabled ();
|
||||
}
|
||||
|
||||
inline bool oldCAC::ioComplete () const
|
||||
inline bool ca_client_context::ioComplete () const
|
||||
{
|
||||
return ( this->pndRecvCnt == 0u );
|
||||
}
|
||||
|
||||
inline unsigned oldCAC::sequenceNumberOfOutstandingIO () const
|
||||
inline unsigned ca_client_context::sequenceNumberOfOutstandingIO () const
|
||||
{
|
||||
return this->ioSeqNo;
|
||||
}
|
||||
|
||||
inline epicsGuard < callbackMutex > oldCAC::callbackGuardFactory ()
|
||||
inline epicsGuard < callbackMutex > ca_client_context::callbackGuardFactory ()
|
||||
{
|
||||
return this->clientCtx.callbackGuardFactory ();
|
||||
}
|
||||
|
||||
inline void oldCACMutex::lock ()
|
||||
inline void ca_client_context_mutex::lock ()
|
||||
{
|
||||
this->mutex.lock ();
|
||||
}
|
||||
|
||||
inline void oldCACMutex::unlock ()
|
||||
inline void ca_client_context_mutex::unlock ()
|
||||
{
|
||||
this->mutex.unlock ();
|
||||
}
|
||||
|
||||
inline void oldCACMutex::show ( unsigned level ) const
|
||||
inline void ca_client_context_mutex::show ( unsigned level ) const
|
||||
{
|
||||
this->mutex.show ( level );
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" void cacNoopAccesRightsHandler ( struct access_rights_handler_args )
|
||||
{
|
||||
}
|
||||
|
||||
oldChannelNotify::oldChannelNotify ( oldCAC & cacIn, const char *pName,
|
||||
oldChannelNotify::oldChannelNotify ( ca_client_context & cacIn, const char *pName,
|
||||
caCh * pConnCallBackIn, void * pPrivateIn, capri priority ) :
|
||||
cacCtx ( cacIn ),
|
||||
io ( cacIn.createChannel ( pName, *this, priority ) ),
|
||||
|
||||
+3
-3
@@ -138,7 +138,7 @@ private:
|
||||
syncGroupWriteNotify & operator = ( const syncGroupWriteNotify & );
|
||||
};
|
||||
|
||||
struct oldCAC;
|
||||
struct ca_client_context;
|
||||
|
||||
class casgMutex {
|
||||
public:
|
||||
@@ -153,7 +153,7 @@ template < class T > class sgAutoPtr;
|
||||
|
||||
struct CASG : public chronIntIdRes < CASG >, private casgRecycle {
|
||||
public:
|
||||
CASG ( oldCAC & cacIn );
|
||||
CASG ( ca_client_context & cacIn );
|
||||
bool ioComplete ();
|
||||
void destroy ();
|
||||
bool verify () const;
|
||||
@@ -178,7 +178,7 @@ private:
|
||||
tsDLList < syncGroupNotify > ioCompletedList;
|
||||
casgMutex mutable mutex;
|
||||
epicsEvent sem;
|
||||
oldCAC & client;
|
||||
ca_client_context & client;
|
||||
unsigned magic;
|
||||
tsFreeList < class syncGroupReadNotify, 128, epicsMutexNOOP > freeListReadOP;
|
||||
tsFreeList < class syncGroupWriteNotify, 128, epicsMutexNOOP > freeListWriteOP;
|
||||
|
||||
+8
-8
@@ -39,7 +39,7 @@
|
||||
*/
|
||||
extern "C" int epicsShareAPI ca_sg_create ( CA_SYNC_GID *pgid ) // X aCC 361
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus;
|
||||
CASG *pcasg;
|
||||
|
||||
@@ -63,7 +63,7 @@ extern "C" int epicsShareAPI ca_sg_create ( CA_SYNC_GID *pgid ) // X aCC 361
|
||||
*/
|
||||
extern "C" int epicsShareAPI ca_sg_delete ( const CA_SYNC_GID gid )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
int caStatus;
|
||||
CASG *pcasg;
|
||||
|
||||
@@ -87,7 +87,7 @@ extern "C" int epicsShareAPI ca_sg_delete ( const CA_SYNC_GID gid )
|
||||
*/
|
||||
extern "C" int epicsShareAPI ca_sg_block ( const CA_SYNC_GID gid, ca_real timeout )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
CASG *pcasg;
|
||||
int status;
|
||||
|
||||
@@ -112,7 +112,7 @@ extern "C" int epicsShareAPI ca_sg_block ( const CA_SYNC_GID gid, ca_real timeou
|
||||
*/
|
||||
extern "C" int epicsShareAPI ca_sg_reset ( const CA_SYNC_GID gid )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
CASG *pcasg;
|
||||
int caStatus;
|
||||
|
||||
@@ -138,7 +138,7 @@ extern "C" int epicsShareAPI ca_sg_reset ( const CA_SYNC_GID gid )
|
||||
*/
|
||||
extern "C" int epicsShareAPI ca_sg_stat ( const CA_SYNC_GID gid )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
CASG *pcasg;
|
||||
|
||||
int caStatus = fetchClientContext (&pcac);
|
||||
@@ -162,7 +162,7 @@ extern "C" int epicsShareAPI ca_sg_stat ( const CA_SYNC_GID gid )
|
||||
*/
|
||||
extern "C" int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ) // X aCC 361
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
CASG *pcasg;
|
||||
int caStatus;
|
||||
|
||||
@@ -190,7 +190,7 @@ extern "C" int epicsShareAPI ca_sg_test ( const CA_SYNC_GID gid ) // X aCC 361
|
||||
extern "C" int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype type,
|
||||
arrayElementCount count, chid pChan, const void *pValue )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
CASG *pcasg;
|
||||
int caStatus;
|
||||
|
||||
@@ -253,7 +253,7 @@ extern "C" int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype typ
|
||||
extern "C" int epicsShareAPI ca_sg_array_get ( const CA_SYNC_GID gid, chtype type,
|
||||
arrayElementCount count, chid pChan, void *pValue )
|
||||
{
|
||||
oldCAC *pcac;
|
||||
ca_client_context *pcac;
|
||||
CASG *pcasg;
|
||||
int caStatus;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user