changed locking mechanisms
This commit is contained in:
@@ -94,7 +94,7 @@ cac::cac () :
|
||||
osiGetUserNameReturn gunRet;
|
||||
|
||||
gunRet = osiGetUserName ( tmp, sizeof (tmp) );
|
||||
if (gunRet!=osiGetUserNameSuccess) {
|
||||
if ( gunRet != osiGetUserNameSuccess ) {
|
||||
tmp[0] = '\0';
|
||||
}
|
||||
len = strlen (tmp) + 1;
|
||||
@@ -841,3 +841,12 @@ bool cac::createChannelIO (const char *pName, cacChannel &chan)
|
||||
return true;
|
||||
}
|
||||
|
||||
void cac::lock () const
|
||||
{
|
||||
semMutexMustTake ( this->ca_client_lock );
|
||||
}
|
||||
|
||||
void cac::unlock () const
|
||||
{
|
||||
semMutexGive ( this->ca_client_lock );
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
#include "iocinf.h"
|
||||
|
||||
osiMutex cacChannel::defaultMutex;
|
||||
|
||||
cacChannel::cacChannel () : pChannelIO (0)
|
||||
{
|
||||
}
|
||||
@@ -33,10 +31,8 @@ cacChannel::~cacChannel ()
|
||||
void cacChannel::attachIO (cacChannelIO &io)
|
||||
{
|
||||
assert ( ! this->pChannelIO );
|
||||
this->lock ();
|
||||
this->pChannelIO = &io;
|
||||
this->ioAttachNotify ();
|
||||
this->unlock ();
|
||||
}
|
||||
|
||||
int cacChannel::read ( unsigned type, unsigned long count, cacNotify & notify )
|
||||
@@ -238,16 +234,6 @@ void cacChannel::connectTimeoutNotify ()
|
||||
{
|
||||
}
|
||||
|
||||
void cacChannel::lock ()
|
||||
{
|
||||
this->defaultMutex.lock();
|
||||
}
|
||||
|
||||
void cacChannel::unlock ()
|
||||
{
|
||||
this->defaultMutex.unlock();
|
||||
}
|
||||
|
||||
unsigned cacChannel::readSequence () const
|
||||
{
|
||||
if ( this->pChannelIO ) {
|
||||
@@ -271,3 +257,17 @@ void cacChannel::incrementOutstandingIO ()
|
||||
this->pChannelIO->incrementOutstandingIO ();
|
||||
}
|
||||
}
|
||||
|
||||
void cacChannel::lock () const
|
||||
{
|
||||
if ( this->pChannelIO ) {
|
||||
this->pChannelIO->lock ();
|
||||
}
|
||||
}
|
||||
|
||||
void cacChannel::unlock () const
|
||||
{
|
||||
if ( this->pChannelIO ) {
|
||||
this->pChannelIO->unlock ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ cacChannelIO::cacChannelIO ( cacChannel &chanIn ) :
|
||||
|
||||
cacChannelIO::~cacChannelIO ()
|
||||
{
|
||||
this->chan.lock ();
|
||||
this->chan.ioReleaseNotify ();
|
||||
this->chan.pChannelIO = 0;
|
||||
this->chan.unlock ();
|
||||
}
|
||||
|
||||
cacLocalChannelIO::cacLocalChannelIO ( cacChannel &chan ) :
|
||||
@@ -51,6 +48,11 @@ void cacChannelIO::accessRightsNotify ( caar ar )
|
||||
this->chan.accessRightsNotify ( ar );
|
||||
}
|
||||
|
||||
void cacChannelIO::ioReleaseNotify ()
|
||||
{
|
||||
this->chan.ioReleaseNotify ();
|
||||
}
|
||||
|
||||
channel_state cacChannelIO::state () const
|
||||
{
|
||||
return cs_conn;
|
||||
@@ -102,14 +104,3 @@ void cacChannelIO::incrementOutstandingIO ()
|
||||
void cacChannelIO::decrementOutstandingIO ()
|
||||
{
|
||||
}
|
||||
|
||||
void cacChannelIO::lock (void)
|
||||
{
|
||||
this->chan.lock ();
|
||||
}
|
||||
|
||||
void cacChannelIO::unlock (void)
|
||||
{
|
||||
this->chan.unlock ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user