Make * to & changes due to changes in pvData.

This commit is contained in:
Marty Kraimer
2011-02-18 08:20:27 -05:00
parent 50af37d7af
commit 753e6d246b
25 changed files with 205 additions and 204 deletions

View File

@@ -26,9 +26,11 @@ TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
# EPICS_BASE usually appears last so other apps can override stuff:
PVDATA=/opt/epics/pvDataCPP
#PVDATA=/opt/epics/pvDataCPP
#EPICS_BASE=/opt/epics/base
EPICS_BASE=/opt/epics/base
PVDATA=/home/mrk/hg/pvDataCPP
EPICS_BASE=/home/install/epics/base
# Set RULES here if you want to take build rules from somewhere
# other than EPICS_BASE:

View File

@@ -12,7 +12,7 @@ ClientContextImpl* ClientFactory::m_context = 0;
void ClientFactory::start()
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_context) return;
@@ -29,7 +29,7 @@ void ClientFactory::start()
void ClientFactory::stop()
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
unregisterChannelProvider(m_context->getProvider());
m_context->dispose();

View File

@@ -24,12 +24,12 @@ class ChannelAccessImpl : public ChannelAccess {
public:
ChannelProvider* getProvider(String providerName) {
Lock guard(&channelProviderMutex);
Lock guard(channelProviderMutex);
return channelProviders[providerName];
}
std::vector<String>* getProviderNames() {
Lock guard(&channelProviderMutex);
Lock guard(channelProviderMutex);
std::vector<String>* providers = new std::vector<String>();
for (ChannelProviderMap::const_iterator i = channelProviders.begin();
i != channelProviders.end(); i++)
@@ -41,7 +41,7 @@ class ChannelAccessImpl : public ChannelAccess {
ChannelAccess * getChannelAccess() {
static Mutex mutex = Mutex();
Lock guard(&mutex);
Lock guard(mutex);
if(channelAccess==0){
channelAccess = new ChannelAccessImpl();
@@ -50,12 +50,12 @@ ChannelAccess * getChannelAccess() {
}
void registerChannelProvider(ChannelProvider *channelProvider) {
Lock guard(&channelProviderMutex);
Lock guard(channelProviderMutex);
channelProviders[channelProvider->getProviderName()] = channelProvider;
}
void unregisterChannelProvider(ChannelProvider *channelProvider) {
Lock guard(&channelProviderMutex);
Lock guard(channelProviderMutex);
channelProviders.erase(channelProvider->getProviderName());
}

View File

@@ -256,7 +256,7 @@ static CreateRequest* createRequest = 0;
CreateRequest * getCreateRequest() {
static Mutex mutex = Mutex();
Lock guard(&mutex);
Lock guard(mutex);
if(createRequest==0){
createRequest = new CreateRequestImpl();

View File

@@ -28,7 +28,7 @@ BeaconEmitter::BeaconEmitter(Transport* transport, ServerContextImpl* context):
_beaconCountLimit = (int16)std::max(10.0f, EPICS_CA_MIN_BEACON_COUNT_LIMIT); // TODO configurable
_startupTime = new TimeStamp();
_startupTime->getCurrent();
_timerNode = new TimerNode(this);
_timerNode = new TimerNode(*this);
}
BeaconEmitter::BeaconEmitter(Transport* transport,const osiSockAddr* serverAddress): _transport(transport)
@@ -49,7 +49,7 @@ BeaconEmitter::BeaconEmitter(Transport* transport,const osiSockAddr* serverAddre
_beaconCountLimit = 10;
_startupTime = new TimeStamp();
_startupTime->getCurrent();
_timerNode = new TimerNode(this);
_timerNode = new TimerNode(*this);
}
BeaconEmitter::~BeaconEmitter()
@@ -136,7 +136,7 @@ void BeaconEmitter::destroy()
void BeaconEmitter::start()
{
_timer->scheduleAfterDelay(_timerNode, 0.0);
_timer->scheduleAfterDelay(*_timerNode, 0.0);
}
void BeaconEmitter::reschedule()
@@ -144,7 +144,7 @@ void BeaconEmitter::reschedule()
const double period = (_beaconSequenceID >= _beaconCountLimit) ? _slowBeaconPeriod : _fastBeaconPeriod;
if (period > 0)
{
_timer->scheduleAfterDelay(_timerNode, period);
_timer->scheduleAfterDelay(*_timerNode, period);
}
}

View File

@@ -40,7 +40,7 @@ void BeaconHandler::beaconNotify(osiSockAddr* from, int8 remoteTransportRevision
bool BeaconHandler::updateBeacon(int8 remoteTransportRevision, TimeStamp* timestamp,
TimeStamp* startupTime, int16 sequentalID)
{
Lock guard(&_mutex);
Lock guard(_mutex);
// first beacon notification check
if (_serverStartupTime.getSecondsPastEpoch() == 0)
{

View File

@@ -40,7 +40,7 @@ namespace epics {
receiveBufferSize, priority), _introspectionRegistry(
new IntrospectionRegistry(false)), _connectionTimeout(beaconInterval
*1000), _unresponsiveTransport(false), _timerNode(
new TimerNode(this)), _verifyOrEcho(true) {
new TimerNode(*this)), _verifyOrEcho(true) {
// _autoDelete = false;
// initialize owners list, send queue
@@ -52,7 +52,7 @@ namespace epics {
// setup connection timeout timer (watchdog)
epicsTimeGetCurrent(&_aliveTimestamp);
context->getTimer()->schedulePeriodic(_timerNode, beaconInterval,
context->getTimer()->schedulePeriodic(*_timerNode, beaconInterval,
beaconInterval);
start();
@@ -83,7 +83,7 @@ namespace epics {
}
void BlockingClientTCPTransport::unresponsiveTransport() {
Lock lock(&_ownersMutex);
Lock lock(_ownersMutex);
if(!_unresponsiveTransport) {
_unresponsiveTransport = true;
@@ -98,14 +98,14 @@ namespace epics {
}
bool BlockingClientTCPTransport::acquire(TransportClient* client) {
Lock lock(&_mutex);
Lock lock(_mutex);
if(_closed) return false;
char ipAddrStr[48];
ipAddrToDottedIP(&_socketAddress.ia, ipAddrStr, sizeof(ipAddrStr));
errlogSevPrintf(errlogInfo, "Acquiring transport to %s.", ipAddrStr);
Lock lock2(&_ownersMutex);
Lock lock2(_ownersMutex);
// TODO double check? if(_closed) return false;
_owners.insert(client);
@@ -124,7 +124,7 @@ namespace epics {
* Notifies clients about disconnect.
*/
void BlockingClientTCPTransport::closedNotifyClients() {
Lock lock(&_ownersMutex);
Lock lock(_ownersMutex);
// check if still acquired
int refs = _owners.size();
@@ -150,7 +150,7 @@ namespace epics {
}
void BlockingClientTCPTransport::release(TransportClient* client) {
Lock lock(&_mutex);
Lock lock(_mutex);
if(_closed) return;
char ipAddrStr[48];
@@ -158,7 +158,7 @@ namespace epics {
errlogSevPrintf(errlogInfo, "Releasing transport to %s.", ipAddrStr);
Lock lock2(&_ownersMutex);
Lock lock2(_ownersMutex);
_owners.erase(client);
// not used anymore
@@ -167,13 +167,13 @@ namespace epics {
}
void BlockingClientTCPTransport::aliveNotification() {
Lock guard(&_ownersMutex);
Lock guard(_ownersMutex);
epicsTimeGetCurrent(&_aliveTimestamp);
if(_unresponsiveTransport) responsiveTransport();
}
void BlockingClientTCPTransport::responsiveTransport() {
Lock lock(&_ownersMutex);
Lock lock(_ownersMutex);
if(_unresponsiveTransport) {
_unresponsiveTransport = false;
@@ -190,7 +190,7 @@ namespace epics {
void BlockingClientTCPTransport::changedTransport() {
_introspectionRegistry->reset();
Lock lock(&_ownersMutex);
Lock lock(_ownersMutex);
set<TransportClient*>::iterator it = _owners.begin();
for(; it!=_owners.end(); it++) {
TransportClient* client = *it;

View File

@@ -44,7 +44,7 @@ namespace epics {
}
void BlockingServerTCPTransport::destroyAllChannels() {
Lock lock(&_channelsMutex);
Lock lock(_channelsMutex);
if(_channels.size()==0) return;
char ipAddrStr[64];
@@ -68,7 +68,7 @@ namespace epics {
}
pvAccessID BlockingServerTCPTransport::preallocateChannelSID() {
Lock lock(&_channelsMutex);
Lock lock(_channelsMutex);
// search first free (theoretically possible loop of death)
pvAccessID sid = ++_lastChannelSID;
while(_channels.find(sid)!=_channels.end())
@@ -78,17 +78,17 @@ namespace epics {
void BlockingServerTCPTransport::registerChannel(pvAccessID sid,
ServerChannel* channel) {
Lock lock(&_channelsMutex);
Lock lock(_channelsMutex);
_channels[sid] = channel;
}
void BlockingServerTCPTransport::unregisterChannel(pvAccessID sid) {
Lock lock(&_channelsMutex);
Lock lock(_channelsMutex);
_channels.erase(sid);
}
ServerChannel* BlockingServerTCPTransport::getChannel(pvAccessID sid) {
Lock lock(&_channelsMutex);
Lock lock(_channelsMutex);
map<pvAccessID, ServerChannel*>::iterator it = _channels.find(sid);
if(it!=_channels.end()) return it->second;
@@ -97,7 +97,7 @@ namespace epics {
}
int BlockingServerTCPTransport::getChannelCount() {
Lock lock(&_channelsMutex);
Lock lock(_channelsMutex);
return _channels.size();
}

View File

@@ -55,7 +55,7 @@ namespace epics {
int16 priority);
virtual bool isClosed() {
Lock guard(&_mutex);
Lock guard(_mutex);
return _closed;
}
@@ -110,12 +110,12 @@ namespace epics {
virtual int getSocketReceiveBufferSize() const;
virtual bool isVerified() {
Lock lock(&_verifiedMutex);
Lock lock(_verifiedMutex);
return _verified;
}
virtual void verified() {
Lock lock(&_verifiedMutex);
Lock lock(_verifiedMutex);
_verified = true;
}

View File

@@ -156,7 +156,7 @@ namespace epics {
while(socketOpen) {
{
Lock guard(&_mutex);
Lock guard(_mutex);
if (_destroyed)
break;
}
@@ -245,7 +245,7 @@ namespace epics {
}
void BlockingTCPAcceptor::destroy() {
Lock guard(&_mutex);
Lock guard(_mutex);
if(_destroyed) return;
_destroyed = true;

View File

@@ -206,7 +206,7 @@ namespace epics {
}
void BlockingTCPTransport::close(bool force) {
Lock lock(&_mutex);
Lock lock(_mutex);
// already closed check
if(_closed) return;
@@ -881,7 +881,7 @@ printf("sendThreadRunnner exception\n");
}
void BlockingTCPTransport::enqueueSendRequest(TransportSender* sender) {
Lock lock(&_sendQueueMutex);
Lock lock(_sendQueueMutex);
if(_closed) return;
sender->acquire();
_sendQueue->insert(sender);
@@ -889,7 +889,7 @@ printf("sendThreadRunnner exception\n");
}
void BlockingTCPTransport::enqueueMonitorSendRequest(TransportSender* sender) {
Lock lock(&_monitorMutex);
Lock lock(_monitorMutex);
if(_closed) return;
sender->acquire();
_monitorSendQueue->insert(sender);

View File

@@ -38,7 +38,7 @@ namespace epics {
virtual ~BlockingUDPTransport();
virtual bool isClosed() {
Lock guard(&_mutex);
Lock guard(_mutex);
return _closed;
}

View File

@@ -77,7 +77,7 @@ namespace epics {
void BlockingUDPTransport::close(bool forced, bool waitForThreadToComplete) {
{
Lock guard(&_mutex);
Lock guard(_mutex);
if(_closed) return;
_closed = true;
@@ -94,7 +94,7 @@ namespace epics {
}
void BlockingUDPTransport::enqueueSendRequest(TransportSender* sender) {
Lock lock(&_sendMutex);
Lock lock(_sendMutex);
_sendToEnabled = false;
_sendBuffer->clear();

View File

@@ -20,7 +20,7 @@ void BaseSearchInstance::initializeSearchInstance()
void BaseSearchInstance::unsetListOwnership()
{
Lock guard(&_mutex);
Lock guard(_mutex);
if (_owner != NULL) this->release();
_owner = NULL;
}
@@ -30,8 +30,8 @@ void BaseSearchInstance::addAndSetListOwnership(ArrayFIFO<SearchInstance*>* newO
if(ownerMutex == NULL) THROW_BASE_EXCEPTION("Null owner mutex");
_ownerMutex = ownerMutex;
Lock ownerGuard(_ownerMutex);
Lock guard(&_mutex);
Lock ownerGuard(*_ownerMutex);
Lock guard(_mutex);
newOwner->push(this);
if (_owner == NULL) this->acquire(); // new owner
_owner = newOwner;
@@ -43,8 +43,8 @@ void BaseSearchInstance::removeAndUnsetListOwnership()
if(_owner == NULL) return;
if(_ownerMutex == NULL) THROW_BASE_EXCEPTION("Null owner mutex");
Lock ownerGuard(_ownerMutex);
Lock guard(&_mutex);
Lock ownerGuard(*_ownerMutex);
Lock guard(_mutex);
if(_owner != NULL)
{
this->release();
@@ -55,7 +55,7 @@ void BaseSearchInstance::removeAndUnsetListOwnership()
int32 BaseSearchInstance::getOwnerIndex()
{
Lock guard(&_mutex);
Lock guard(_mutex);
int32 retval = _ownerIndex;
return retval;
}
@@ -102,7 +102,7 @@ SearchTimer::SearchTimer(ChannelSearchManager* _chanSearchManager, int32 timerIn
_allowSlowdown(allowSlowdown),
_requestPendingChannels(new ArrayFIFO<SearchInstance*>),
_responsePendingChannels(new ArrayFIFO<SearchInstance*>),
_timerNode(new TimerNode(this)),
_timerNode(new TimerNode(*this)),
_canceled(false),
_timeAtResponseCheck(0)
{
@@ -118,16 +118,16 @@ SearchTimer::~SearchTimer()
void SearchTimer::shutdown()
{
Lock guard(&_mutex); //the whole method is locked
Lock guard(_mutex); //the whole method is locked
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_canceled) return;
_canceled = true;
}
{
Lock guard(&_requestPendingChannelsMutex);
Lock guard(_requestPendingChannelsMutex);
_timerNode->cancel();
_requestPendingChannels->clear();
@@ -137,10 +137,10 @@ void SearchTimer::shutdown()
void SearchTimer::installChannel(SearchInstance* channel)
{
Lock guard(&_mutex); //the whole method is locked
Lock guard(_mutex); //the whole method is locked
if(_canceled) return;
Lock pendingChannelGuard(&_requestPendingChannelsMutex);
Lock pendingChannelGuard(_requestPendingChannelsMutex);
bool startImmediately = _requestPendingChannels->isEmpty();
channel->addAndSetListOwnership(_requestPendingChannels, &_requestPendingChannelsMutex, _timerIndex);
@@ -156,7 +156,7 @@ void SearchTimer::installChannel(SearchInstance* channel)
}
// start with some initial delay (to collect all installed requests)
_chanSearchManager->_context->getTimer()->scheduleAfterDelay(_timerNode, 0.01);
_chanSearchManager->_context->getTimer()->scheduleAfterDelay(*_timerNode, 0.01);
}
}
@@ -167,7 +167,7 @@ void SearchTimer::moveChannels(SearchTimer* destination)
while((channel = _responsePendingChannels->pop()) != NULL)
{
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_searchAttempts > 0)
{
_searchAttempts--;
@@ -177,7 +177,7 @@ void SearchTimer::moveChannels(SearchTimer* destination)
}
// bulk move
Lock guard(&_requestPendingChannelsMutex);
Lock guard(_requestPendingChannelsMutex);
while (!_requestPendingChannels->isEmpty())
{
destination->installChannel(_requestPendingChannels->pop());
@@ -192,7 +192,7 @@ void SearchTimer::timerStopped()
void SearchTimer::callback()
{
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_canceled) return;
}
@@ -200,12 +200,12 @@ void SearchTimer::callback()
// boost search period (if necessary) for channels not recently searched
int32 searchRespones;
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
searchRespones = _searchRespones;
}
if(_allowBoost && searchRespones > 0)
{
Lock guard(&_requestPendingChannelsMutex);
Lock guard(_requestPendingChannelsMutex);
while(!_requestPendingChannels->isEmpty())
{
SearchInstance* channel = _requestPendingChannels->peek();
@@ -251,7 +251,7 @@ void SearchTimer::callback()
int32 searchRespones,searchAttempts;
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
searchAttempts = _searchAttempts;
searchRespones = _searchRespones;
}
@@ -287,7 +287,7 @@ void SearchTimer::callback()
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
_startSequenceNumber = _chanSearchManager->getSequenceNumber() + 1;
_searchAttempts = 0;
_searchRespones = 0;
@@ -299,13 +299,13 @@ void SearchTimer::callback()
// reschedule
bool canceled;
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
canceled = _canceled;
}
{
Lock guard(&_requestPendingChannelsMutex);
Lock guard(_requestPendingChannelsMutex);
channel = _requestPendingChannels->pop();
}
while (!canceled && channel != NULL)
@@ -338,7 +338,7 @@ void SearchTimer::callback()
if(requestSent)
{
channel->addAndSetListOwnership(_responsePendingChannels, &_responsePendingChannelsMutex, _timerIndex);
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_searchAttempts < INT_MAX)
{
_searchAttempts++;
@@ -351,12 +351,12 @@ void SearchTimer::callback()
if(triesInFrame == 0 && !allowNewFrame) break;
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
canceled = _canceled;
}
{
Lock guard(&_requestPendingChannelsMutex);
Lock guard(_requestPendingChannelsMutex);
channel = _requestPendingChannels->pop();
}
}
@@ -371,19 +371,19 @@ void SearchTimer::callback()
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
_endSequenceNumber = _chanSearchManager->getSequenceNumber();
// reschedule
canceled = _canceled;
}
Lock guard(&_requestPendingChannelsMutex);
Lock guard(_requestPendingChannelsMutex);
if(!canceled && !_timerNode->isScheduled())
{
bool someWorkToDo = (!_requestPendingChannels->isEmpty() || !_responsePendingChannels->isEmpty());
if(someWorkToDo)
{
_chanSearchManager->_context->getTimer()->scheduleAfterDelay(_timerNode, period()/1000.0);
_chanSearchManager->_context->getTimer()->scheduleAfterDelay(*_timerNode, period()/1000.0);
}
}
}
@@ -392,7 +392,7 @@ void SearchTimer::searchResponse(int32 responseSequenceNumber, bool isSequenceNu
{
bool validResponse = true;
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_canceled) return;
if(isSequenceNumberValid)
@@ -407,7 +407,7 @@ void SearchTimer::searchResponse(int32 responseSequenceNumber, bool isSequenceNu
{
const int64 dt = responseTime - _chanSearchManager->getTimeAtLastSend();
_chanSearchManager->updateRTTE(dt);
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_searchRespones < INT_MAX)
{
_searchRespones++;
@@ -418,7 +418,7 @@ void SearchTimer::searchResponse(int32 responseSequenceNumber, bool isSequenceNu
if(_requestPendingChannels->size() > 0)
{
_timerNode->cancel();
_chanSearchManager->_context->getTimer()->scheduleAfterDelay(_timerNode, 0.0);
_chanSearchManager->_context->getTimer()->scheduleAfterDelay(*_timerNode, 0.0);
}
}
}
@@ -487,10 +487,10 @@ ChannelSearchManager::~ChannelSearchManager()
void ChannelSearchManager::cancel()
{
Lock guard(&_mutex);
Lock guard(_mutex);
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_canceled) return;
_canceled = true;
@@ -507,18 +507,18 @@ void ChannelSearchManager::cancel()
int32 ChannelSearchManager::registeredChannelCount()
{
Lock guard(&_channelMutex);
Lock guard(_channelMutex);
return _channels.size();
}
void ChannelSearchManager::registerChannel(SearchInstance* channel)
{
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
if(_canceled) return;
}
Lock guard(&_channelMutex);
Lock guard(_channelMutex);
//overrides if already registered
_channels[channel->getSearchInstanceID()] = channel;
_timers[0]->installChannel(channel);
@@ -526,7 +526,7 @@ void ChannelSearchManager::registerChannel(SearchInstance* channel)
void ChannelSearchManager::unregisterChannel(SearchInstance* channel)
{
Lock guard(&_channelMutex);
Lock guard(_channelMutex);
_channelsIter = _channels.find(channel->getSearchInstanceID());
if(_channelsIter != _channels.end())
{
@@ -538,7 +538,7 @@ void ChannelSearchManager::unregisterChannel(SearchInstance* channel)
void ChannelSearchManager::searchResponse(int32 cid, int32 seqNo, int8 minorRevision, osiSockAddr* serverAddress)
{
Lock guard(&_channelMutex);
Lock guard(_channelMutex);
// first remove
SearchInstance* si = NULL;
_channelsIter = _channels.find(cid);
@@ -583,7 +583,7 @@ void ChannelSearchManager::beaconAnomalyNotify()
void ChannelSearchManager::initializeSendBuffer()
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
_sequenceNumber++;
@@ -606,8 +606,8 @@ void ChannelSearchManager::initializeSendBuffer()
void ChannelSearchManager::flushSendBuffer()
{
Lock guard(&_mutex);
Lock volGuard(&_volMutex);
Lock guard(_mutex);
Lock volGuard(_volMutex);
TimeStamp now;
now.getCurrent();
_timeAtLastSend = now.getMilliseconds();
@@ -617,7 +617,7 @@ void ChannelSearchManager::flushSendBuffer()
bool ChannelSearchManager::generateSearchRequestMessage(SearchInstance* channel, bool allowNewFrame)
{
Lock guard(&_mutex);
Lock guard(_mutex);
bool success = channel->generateSearchRequestMessage(_sendBuffer, _mockTransportSendControl);
// buffer full, flush
if(!success)
@@ -645,28 +645,28 @@ void ChannelSearchManager::boostSearching(SearchInstance* channel, int32 timerIn
inline void ChannelSearchManager::updateRTTE(long rtt)
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
const double error = rtt - _rttmean;
_rttmean += error / 4.0;
}
inline double ChannelSearchManager::getRTTE()
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
double rtte = min(max((double)_rttmean, (double)MIN_RTT), (double)MAX_RTT);
return rtte;
}
inline int32 ChannelSearchManager::getSequenceNumber()
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
int32 retval = _sequenceNumber;
return retval;
}
inline int64 ChannelSearchManager::getTimeAtLastSend()
{
Lock guard(&_volMutex);
Lock guard(_volMutex);
int64 retval = _timeAtLastSend;
return retval;
}

View File

@@ -110,7 +110,7 @@ namespace epics {
}
bool startRequest(int32 qos) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
// we allow pure destroy...
if (m_pendingRequest != NULL_REQUEST && qos != PURE_DESTROY_REQUEST)
@@ -121,12 +121,12 @@ namespace epics {
}
void stopRequest() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_pendingRequest = NULL_REQUEST;
}
int32 getPendingRequest() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
return m_pendingRequest;
}
@@ -189,7 +189,7 @@ namespace epics {
virtual void destroy() {
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_destroyed)
return;
m_destroyed = true;
@@ -257,7 +257,7 @@ namespace epics {
}
virtual void acquire() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_refCount++;
}
@@ -363,7 +363,7 @@ namespace epics {
{
// TODO optimize
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_destroyed) {
EXCEPTION_GUARD(m_callback->processDone(destroyedStatus));
return;
@@ -511,7 +511,7 @@ namespace epics {
virtual void get(bool lastRequest) {
// TODO optimize
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_destroyed) {
EXCEPTION_GUARD(m_channelGetRequester->getDone(destroyedStatus));
return;
@@ -1418,7 +1418,7 @@ namespace epics {
virtual void destroy()
{
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_destroyed)
return;
m_destroyed = true;
@@ -1432,7 +1432,7 @@ namespace epics {
}
virtual void acquire() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_refCount++;
}
@@ -1507,19 +1507,19 @@ namespace epics {
}
virtual void response(Transport* transport, ByteBuffer* payloadBuffer) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_gotMonitor = true;
// no data, only notify
m_callback->monitorEvent(this);
}
virtual MonitorElement* poll() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
return m_gotMonitor ? this : 0;
}
virtual void release(MonitorElement* monitorElement) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_gotMonitor = false;
}
@@ -1583,7 +1583,7 @@ namespace epics {
}
virtual void init(Structure* structure) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
structure->incReferenceCount();
m_monitorElementStructure = getPVDataCreate()->createPVStructure(0, structure);
@@ -1593,7 +1593,7 @@ namespace epics {
}
virtual void response(Transport* transport, ByteBuffer* payloadBuffer) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
// simply deserialize and notify
m_monitorElementChangeBitSet->deserialize(payloadBuffer, transport);
m_monitorElementStructure->deserialize(payloadBuffer, transport, m_monitorElementChangeBitSet);
@@ -1603,17 +1603,17 @@ namespace epics {
}
virtual MonitorElement* poll() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
return m_gotMonitor ? this : 0;
}
virtual void release(MonitorElement* monitorElement) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_gotMonitor = false;
}
Status start() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_gotMonitor = false;
return Status::OK;
}
@@ -1685,7 +1685,7 @@ namespace epics {
}
virtual void init(Structure* structure) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
structure->incReferenceCount();
m_monitorElementStructure = getPVDataCreate()->createPVStructure(0, structure);
@@ -1699,7 +1699,7 @@ namespace epics {
}
virtual void response(Transport* transport, ByteBuffer* payloadBuffer) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (!m_gotMonitor)
{
@@ -1730,7 +1730,7 @@ namespace epics {
}
virtual MonitorElement* poll() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (!m_gotMonitor) return 0;
// compress if needed
@@ -1745,12 +1745,12 @@ namespace epics {
}
virtual void release(MonitorElement* monitorElement) {
Lock guard(&m_mutex);
Lock guard(m_mutex);
m_gotMonitor = false;
}
Status start() {
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (!m_monitorElementChangeBitSet)
return Status(Status::STATUSTYPE_ERROR, "Monitor not connected.");
m_gotMonitor = false;
@@ -1961,7 +1961,7 @@ namespace epics {
virtual Status start()
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_destroyed)
return BaseRequestImpl::destroyedStatus;
@@ -1985,7 +1985,7 @@ namespace epics {
virtual Status stop()
{
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_destroyed)
return BaseRequestImpl::destroyedStatus;
@@ -2644,7 +2644,7 @@ namespace epics {
// NOTE: synchronization guarantees that <code>transport</code> is non-<code>0</code> and <code>state == CONNECTED</code>.
virtual epics::pvData::String getRemoteAddress()
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState != CONNECTED) {
static String emptyString;
return emptyString;
@@ -2667,7 +2667,7 @@ namespace epics {
virtual ConnectionState getConnectionState()
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
return m_connectionState;
}
@@ -2702,24 +2702,24 @@ namespace epics {
}
virtual pvAccessID getServerChannelID() {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
return m_serverChannelID;
}
virtual void registerResponseRequest(ResponseRequest* responseRequest)
{
Lock guard(&m_responseRequestsMutex);
Lock guard(m_responseRequestsMutex);
m_responseRequests[responseRequest->getIOID()] = responseRequest;
}
virtual void unregisterResponseRequest(ResponseRequest* responseRequest)
{
Lock guard(&m_responseRequestsMutex);
Lock guard(m_responseRequestsMutex);
m_responseRequests.erase(responseRequest->getIOID());
}
void connect() {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
// if not destroyed...
if (m_connectionState == DESTROYED)
throw std::runtime_error("Channel destroyed.");
@@ -2728,7 +2728,7 @@ namespace epics {
}
void disconnect() {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
// if not destroyed...
if (m_connectionState == DESTROYED)
throw std::runtime_error("Channel destroyed.");
@@ -2743,7 +2743,7 @@ namespace epics {
*/
void createChannel(Transport* transport)
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
// do not allow duplicate creation to the same transport
if (!m_allowCreation)
@@ -2782,7 +2782,7 @@ namespace epics {
*/
virtual void createChannelFailed()
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
cancel();
// ... and search again
@@ -2796,7 +2796,7 @@ namespace epics {
*/
virtual void connectionCompleted(pvAccessID sid/*, rights*/)
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
bool allOK = false;
try
@@ -2833,7 +2833,7 @@ namespace epics {
*/
void destroy(bool force) {
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState == DESTROYED)
return;
//throw std::runtime_error("Channel already destroyed.");
@@ -2849,7 +2849,7 @@ namespace epics {
// it is not related to channel destroy; not a mechanism to
// allow channel sharing
void acquire() {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
m_references++;
}
@@ -2880,7 +2880,7 @@ namespace epics {
*/
void destroyChannel(bool force) {
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState == DESTROYED)
throw std::runtime_error("Channel already destroyed.");
@@ -2920,7 +2920,7 @@ namespace epics {
* @param remoteDestroy issue channel destroy request.
*/
void disconnect(bool initiateSearch, bool remoteDestroy) {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState != CONNECTED && !m_transport)
return;
@@ -2962,7 +2962,7 @@ namespace epics {
*/
void initiateSearch()
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
m_allowCreation = true;
@@ -2978,7 +2978,7 @@ namespace epics {
}
virtual void searchResponse(int8 minorRevision, osiSockAddr* serverAddress) {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
Transport* transport = m_transport;
if (transport)
{
@@ -3012,7 +3012,7 @@ namespace epics {
virtual Transport* checkAndGetTransport()
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
// TODO C-fy
if (m_connectionState == DESTROYED)
throw std::runtime_error("Channel destroyed.");
@@ -3023,12 +3023,12 @@ namespace epics {
virtual Transport* getTransport()
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
return m_transport;
}
virtual void transportResponsive(Transport* transport) {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState == DISCONNECTED)
{
updateSubscriptions();
@@ -3039,7 +3039,7 @@ namespace epics {
}
void transportUnresponsive() {
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState == CONNECTED)
{
// NOTE: 2 types of disconnected state - distinguish them
@@ -3055,7 +3055,7 @@ namespace epics {
*/
void setConnectionState(ConnectionState connectionState)
{
Lock guard(&m_channelMutex);
Lock guard(m_channelMutex);
if (m_connectionState != connectionState)
{
m_connectionState = connectionState;
@@ -3122,7 +3122,7 @@ namespace epics {
{
Status* status = destroy ? &channelDestroyed : &channelDisconnected;
Lock guard(&m_responseRequestsMutex);
Lock guard(m_responseRequestsMutex);
m_needSubscriptionUpdate = true;
@@ -3147,7 +3147,7 @@ namespace epics {
// TODO to be called from non-transport thread !!!!!!
void resubscribeSubscriptions()
{
Lock guard(&m_responseRequestsMutex);
Lock guard(m_responseRequestsMutex);
Transport* transport = getTransport();
@@ -3168,7 +3168,7 @@ namespace epics {
// TODO to be called from non-transport thread !!!!!!
void updateSubscriptions()
{
Lock guard(&m_responseRequestsMutex);
Lock guard(m_responseRequestsMutex);
if (m_needSubscriptionUpdate)
m_needSubscriptionUpdate = false;
@@ -3248,7 +3248,7 @@ namespace epics {
}
virtual void printInfo(epics::pvData::StringBuilder out) {
//Lock lock(&m_channelMutex);
//Lock lock(m_channelMutex);
//std::ostringstream ostr;
//static String emptyString;
@@ -3390,30 +3390,30 @@ TODO
}
virtual ChannelProvider* getProvider() {
Lock lock(&m_contextMutex);
Lock lock(m_contextMutex);
return m_provider;
}
virtual Timer* getTimer()
{
Lock lock(&m_contextMutex);
Lock lock(m_contextMutex);
return m_timer;
}
virtual TransportRegistry* getTransportRegistry()
{
Lock lock(&m_contextMutex);
Lock lock(m_contextMutex);
return m_transportRegistry;
}
virtual BlockingUDPTransport* getSearchTransport()
{
Lock lock(&m_contextMutex);
Lock lock(m_contextMutex);
return m_searchTransport;
}
virtual void initialize() {
Lock lock(&m_contextMutex);
Lock lock(m_contextMutex);
if (m_contextState == CONTEXT_DESTROYED)
throw std::runtime_error("Context destroyed.");
@@ -3432,7 +3432,7 @@ TODO
}
virtual void printInfo(epics::pvData::StringBuilder out) {
Lock lock(&m_contextMutex);
Lock lock(m_contextMutex);
std::ostringstream ostr;
static String emptyString;
@@ -3465,7 +3465,7 @@ TODO
virtual void destroy()
{
{
Lock guard(&m_contextMutex);
Lock guard(m_contextMutex);
if (m_contextState == CONTEXT_DESTROYED)
{
@@ -3487,7 +3487,7 @@ TODO
}
virtual void acquire() {
Lock guard(&m_contextMutex);
Lock guard(m_contextMutex);
m_refCount++;
}
@@ -3627,7 +3627,7 @@ TODO
}
void destroyAllChannels() {
Lock guard(&m_cidMapMutex);
Lock guard(m_cidMapMutex);
int count = 0;
ChannelImpl* channels[m_channelsByCID.size()];
@@ -3658,7 +3658,7 @@ TODO
* Check context state and tries to establish necessary state.
*/
void checkState() {
Lock lock(&m_contextMutex); // TODO check double-lock?!!!
Lock lock(m_contextMutex); // TODO check double-lock?!!!
if (m_contextState == CONTEXT_DESTROYED)
throw std::runtime_error("Context destroyed.");
@@ -3672,7 +3672,7 @@ TODO
*/
void registerChannel(ChannelImpl* channel)
{
Lock guard(&m_cidMapMutex);
Lock guard(m_cidMapMutex);
m_channelsByCID[channel->getChannelID()] = channel;
}
@@ -3682,7 +3682,7 @@ TODO
*/
void unregisterChannel(ChannelImpl* channel)
{
Lock guard(&m_cidMapMutex);
Lock guard(m_cidMapMutex);
m_channelsByCID.erase(channel->getChannelID());
}
@@ -3693,7 +3693,7 @@ TODO
*/
ChannelImpl* getChannel(pvAccessID channelID)
{
Lock guard(&m_cidMapMutex);
Lock guard(m_cidMapMutex);
CIDChannelMap::iterator it = m_channelsByCID.find(channelID);
return (it == m_channelsByCID.end() ? 0 : it->second);
}
@@ -3704,7 +3704,7 @@ TODO
*/
pvAccessID generateCID()
{
Lock guard(&m_cidMapMutex);
Lock guard(m_cidMapMutex);
// search first free (theoretically possible loop of death)
while (m_channelsByCID.find(++m_lastCID) != m_channelsByCID.end());
@@ -3718,7 +3718,7 @@ TODO
*/
void freeCID(int cid)
{
Lock guard(&m_cidMapMutex);
Lock guard(m_cidMapMutex);
m_channelsByCID.erase(cid);
}
@@ -3730,7 +3730,7 @@ TODO
*/
ResponseRequest* getResponseRequest(pvAccessID ioid)
{
Lock guard(&m_ioidMapMutex);
Lock guard(m_ioidMapMutex);
IOIDResponseRequestMap::iterator it = m_pendingResponseRequests.find(ioid);
if (it == m_pendingResponseRequests.end()) return 0;
ResponseRequest* rr = it->second;
@@ -3745,7 +3745,7 @@ TODO
*/
pvAccessID registerResponseRequest(ResponseRequest* request)
{
Lock guard(&m_ioidMapMutex);
Lock guard(m_ioidMapMutex);
pvAccessID ioid = generateIOID();
m_pendingResponseRequests[ioid] = request;
return ioid;
@@ -3758,7 +3758,7 @@ TODO
*/
ResponseRequest* unregisterResponseRequest(ResponseRequest* request)
{
Lock guard(&m_ioidMapMutex);
Lock guard(m_ioidMapMutex);
IOIDResponseRequestMap::iterator it = m_pendingResponseRequests.find(request->getIOID());
if (it == m_pendingResponseRequests.end())
return 0;
@@ -3774,7 +3774,7 @@ TODO
*/
pvAccessID generateIOID()
{
Lock guard(&m_ioidMapMutex);
Lock guard(m_ioidMapMutex);
// search first free (theoretically possible loop of death)
@@ -3801,7 +3801,7 @@ TODO
BeaconHandler* getBeaconHandler(osiSockAddr* responseFrom)
{
// TODO delete handlers
Lock guard(&m_beaconMapMutex);
Lock guard(m_beaconMapMutex);
AddressBeaconHandlerMap::iterator it = m_beaconHandlers.find(*responseFrom);
BeaconHandler* handler;
if (it == m_beaconHandlers.end())

View File

@@ -106,7 +106,7 @@ void ServerContextImpl::loadConfiguration()
void ServerContextImpl::initialize(ChannelAccess* channelAccess)
{
//TODO uncomment
/*Lock guard(&_mutex);
/*Lock guard(_mutex);
if (channelAccess == NULL)
{
THROW_BASE_EXCEPTION("non null channelAccess expected");
@@ -224,7 +224,7 @@ void ServerContextImpl::run(int32 seconds)
}
{
Lock guard(&_mutex);
Lock guard(_mutex);
if (_state == NOT_INITIALIZED)
{
@@ -260,14 +260,14 @@ void ServerContextImpl::run(int32 seconds)
}
{
Lock guard(&_mutex);
Lock guard(_mutex);
_state = SHUTDOWN;
}
}
void ServerContextImpl::shutdown()
{
Lock guard(&_mutex);
Lock guard(_mutex);
if(_state == DESTROYED)
{
THROW_BASE_EXCEPTION("Context already destroyed.");
@@ -279,7 +279,7 @@ void ServerContextImpl::shutdown()
void ServerContextImpl::destroy()
{
Lock guard(&_mutex);
Lock guard(_mutex);
if (_state == DESTROYED)
{
THROW_BASE_EXCEPTION("Context already destroyed.");
@@ -365,7 +365,7 @@ void ServerContextImpl::printInfo()
void ServerContextImpl::printInfo(ostream& str)
{
Lock guard(&_mutex);
Lock guard(_mutex);
str << "VERSION : " << getVersion().getVersionString() << endl \
<< "CHANNEL PROVIDER : " << _channelProviderName << endl \
<< "BEACON_ADDR_LIST : " << _beaconAddressList << endl \
@@ -397,13 +397,13 @@ void ServerContextImpl::setBeaconServerStatusProvider(BeaconServerStatusProvider
bool ServerContextImpl::isInitialized()
{
Lock guard(&_mutex);
Lock guard(_mutex);
return _state == INITIALIZED || _state == RUNNING || _state == SHUTDOWN;
}
bool ServerContextImpl::isDestroyed()
{
Lock guard(&_mutex);
Lock guard(_mutex);
return _state == DESTROYED;
}

View File

@@ -222,7 +222,7 @@ namespace epics {
template<class T>
void ArrayFIFO<T>::addFirst(const T e) {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
_elements[_head = (_head-1)&(_size-1)] = e;
if(_head==_tail) doubleCapacity();
@@ -230,7 +230,7 @@ namespace epics {
template<class T>
void ArrayFIFO<T>::addLast(const T e) {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
_elements[_tail] = e;
if((_tail = (_tail+1)&(_size-1))==_head) doubleCapacity();
@@ -238,7 +238,7 @@ namespace epics {
template<class T>
T ArrayFIFO<T>::pollFirst() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
if(isEmpty()) return 0;
@@ -249,7 +249,7 @@ namespace epics {
template<class T>
T ArrayFIFO<T>::pollLast() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
if(isEmpty()) return 0;
@@ -259,7 +259,7 @@ namespace epics {
template<class T>
T ArrayFIFO<T>::peekFirst() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
if(isEmpty()) return 0;
@@ -268,7 +268,7 @@ namespace epics {
template<class T>
T ArrayFIFO<T>::peekLast() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
if(isEmpty()) return 0;
@@ -292,21 +292,21 @@ namespace epics {
template<class T>
size_t ArrayFIFO<T>::size() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
return (_tail-_head)&(_size-1);
}
template<class T>
bool ArrayFIFO<T>::isEmpty() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
return _head==_tail;
}
template<class T>
void ArrayFIFO<T>::clear() {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
_head = _tail = 0;
}
@@ -354,7 +354,7 @@ namespace epics {
template<class T>
bool ArrayFIFO<T>::remove(const T e) {
epics::pvData::Lock lock(&_mutex);
epics::pvData::Lock lock(_mutex);
if(isEmpty()) return false; // nothing to do

View File

@@ -281,7 +281,7 @@ ConfigurationProviderImpl::~ConfigurationProviderImpl()
void ConfigurationProviderImpl::registerConfiguration(const string name, const Configuration* configuration)
{
Lock guard(&_mutex);
Lock guard(_mutex);
_configsIter = _configs.find(name);
if(_configsIter != _configs.end())
{
@@ -306,7 +306,7 @@ Mutex ConfigurationFactory::_conf_factory_mutex = Mutex();
ConfigurationProviderImpl* ConfigurationFactory::getProvider()
{
Lock guard(&_conf_factory_mutex);
Lock guard(_conf_factory_mutex);
if(_configurationProvider == NULL)
{
_configurationProvider = new ConfigurationProviderImpl();

View File

@@ -29,7 +29,7 @@ IntrospectionRegistry::~IntrospectionRegistry()
void IntrospectionRegistry::reset()
{
Lock guard(&_mutex);
Lock guard(_mutex);
_outgoingIdPointer = _direction;
//decrement references
for(_registryRIter = _registry.rbegin(); _registryRIter != _registry.rend(); _registryRIter++)
@@ -41,7 +41,7 @@ void IntrospectionRegistry::reset()
FieldConstPtr IntrospectionRegistry::getIntrospectionInterface(const short id)
{
Lock guard(&_mutex);
Lock guard(_mutex);
_registryIter = _registry.find(id);
if(_registryIter == _registry.end())
{
@@ -52,7 +52,7 @@ FieldConstPtr IntrospectionRegistry::getIntrospectionInterface(const short id)
void IntrospectionRegistry::registerIntrospectionInterface(const short id,FieldConstPtr field)
{
Lock guard(&_mutex);
Lock guard(_mutex);
//first decrement reference on old value
_registryIter = _registry.find(id);
if(_registryIter != _registry.end())
@@ -65,7 +65,7 @@ void IntrospectionRegistry::registerIntrospectionInterface(const short id,FieldC
short IntrospectionRegistry::registerIntrospectionInterface(FieldConstPtr field, bool& existing)
{
Lock guard(&_mutex);
Lock guard(_mutex);
short key;
if(registryContainsValue(field, key))
{

View File

@@ -62,8 +62,8 @@ namespace epics {
}
void createFileLogger(String fname) {
static Mutex mutex = Mutex();
Lock xx(&mutex);
static Mutex mutex;
Lock xx(mutex);
if(fileLogger==NULL) {
fileLogger = new FileLogger(fname);

View File

@@ -66,7 +66,7 @@ bool NamedLockPattern<Key,Compare>::acquireSynchronizationObject(const Key name,
{
ReferenceCountingLock* lock;
{ //due to guard
epics::pvData::Lock guard(&_mutex);
epics::pvData::Lock guard(_mutex);
_namedLocksIter = _namedLocks.find(name);
// get synchronization object
@@ -104,7 +104,7 @@ void NamedLockPattern<Key,Compare>::releaseSynchronizationObject(const Key name)
template <class Key, class Compare>
void NamedLockPattern<Key,Compare>::releaseSynchronizationObject(const Key name,const bool release)
{
epics::pvData::Lock guard(&_mutex);
epics::pvData::Lock guard(_mutex);
ReferenceCountingLock* lock;
_namedLocksIter = _namedLocks.find(name);

View File

@@ -20,7 +20,7 @@ ReferenceCountingLock::ReferenceCountingLock(): _references(1)
retval = pthread_mutexattr_settype(&mutexAttribute, PTHREAD_MUTEX_RECURSIVE);
if(retval == 0)
{
retval = pthread_mutex_init(&_mutex, &mutexAttribute);
retval = pthread_mutex_init(_mutex, &mutexAttribute);
if(retval != 0)
{
//string errMsg = "Error: pthread_mutex_init failed: " + string(strerror(retval));
@@ -38,7 +38,7 @@ ReferenceCountingLock::ReferenceCountingLock(): _references(1)
ReferenceCountingLock::~ReferenceCountingLock()
{
// pthread_mutex_destroy(&_mutex);
// pthread_mutex_destroy(_mutex);
}
bool ReferenceCountingLock::acquire(int64 msecs)
@@ -57,7 +57,7 @@ bool ReferenceCountingLock::acquire(int64 msecs)
deltatime.tv_nsec = 0;
}
int32 retval = pthread_mutex_timedlock(&_mutex, &deltatime);
int32 retval = pthread_mutex_timedlock(_mutex, &deltatime);
if(retval == 0)
{
return true;
@@ -69,7 +69,7 @@ bool ReferenceCountingLock::acquire(int64 msecs)
void ReferenceCountingLock::release()
{
_mutex.unlock();
/* int retval = pthread_mutex_unlock(&_mutex);
/* int retval = pthread_mutex_unlock(_mutex);
if(retval != 0)
{
//string errMsg = "Error: pthread_mutex_unlock failed: " + string(strerror(retval));
@@ -79,14 +79,14 @@ void ReferenceCountingLock::release()
int ReferenceCountingLock::increment()
{
Lock guard(&_countMutex);
Lock guard(_countMutex);
++_references;
return _references;
}
int ReferenceCountingLock::decrement()
{
Lock guard(&_countMutex);
Lock guard(_countMutex);
--_references;
return _references;
}

View File

@@ -21,7 +21,7 @@ TransportRegistry::~TransportRegistry()
void TransportRegistry::put(Transport* transport)
{
Lock guard(&_mutex);
Lock guard(_mutex);
//const String type = transport.getType();
const int16 priority = transport->getPriority();
const osiSockAddr* address = transport->getRemoteAddress();
@@ -43,7 +43,7 @@ void TransportRegistry::put(Transport* transport)
Transport* TransportRegistry::get(const String type, const osiSockAddr* address, const int16 priority)
{
Lock guard(&_mutex);
Lock guard(_mutex);
_transportsIter = _transports.find(address);
if(_transportsIter != _transports.end())
{
@@ -59,7 +59,7 @@ Transport* TransportRegistry::get(const String type, const osiSockAddr* address,
Transport** TransportRegistry::get(const String type, const osiSockAddr* address, int32& size)
{
Lock guard(&_mutex);
Lock guard(_mutex);
_transportsIter = _transports.find(address);
if(_transportsIter != _transports.end())
{
@@ -78,7 +78,7 @@ Transport** TransportRegistry::get(const String type, const osiSockAddr* address
Transport* TransportRegistry::remove(Transport* transport)
{
Lock guard(&_mutex);
Lock guard(_mutex);
const int16 priority = transport->getPriority();
const osiSockAddr* address = transport->getRemoteAddress();
Transport* retTransport = NULL;
@@ -111,7 +111,7 @@ Transport* TransportRegistry::remove(Transport* transport)
void TransportRegistry::clear()
{
Lock guard(&_mutex);
Lock guard(_mutex);
for(_transportsIter = _transports.begin(); _transportsIter != _transports.end(); _transportsIter++)
{
delete _transportsIter->second;
@@ -123,14 +123,14 @@ void TransportRegistry::clear()
int TransportRegistry::numberOfActiveTransports()
{
Lock guard(&_mutex);
Lock guard(_mutex);
return (int32)_allTransports.size();
}
Transport** TransportRegistry::toArray(const String type, int32& size)
{
// TODO support type
Lock guard(&_mutex);
Lock guard(_mutex);
size = _allTransports.size();
Transport** transportArray = new Transport*[size];
int i = 0;
@@ -143,7 +143,7 @@ Transport** TransportRegistry::toArray(const String type, int32& size)
Transport** TransportRegistry::toArray(int32& size)
{
Lock guard(&_mutex);
Lock guard(_mutex);
size = _allTransports.size();
if(size == 0)

View File

@@ -271,7 +271,7 @@ class MockMonitor : public Monitor, public MonitorElement
BitSet* m_changedBitSet;
BitSet* m_overrunBitSet;
bool m_first;
Mutex* m_lock;
Mutex m_lock;
int m_count;
private:
@@ -286,7 +286,7 @@ class MockMonitor : public Monitor, public MonitorElement
m_changedBitSet(new BitSet(pvStructure->getNumberFields())),
m_overrunBitSet(new BitSet(pvStructure->getNumberFields())),
m_first(true),
m_lock(new Mutex()),
m_lock(),
m_count(0)
{
PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockMonitor);
@@ -335,7 +335,6 @@ class MockMonitor : public Monitor, public MonitorElement
{
stop();
delete m_lock;
delete m_overrunBitSet;
delete m_changedBitSet;
delete this;

View File

@@ -116,7 +116,7 @@ class ChannelGetRequesterImpl : public ChannelGetRequester
virtual void getDone(const epics::pvData::Status& status)
{
std::cout << "getDone(" << status.toString() << ")" << std::endl;
Lock guard(&m_mutex);
Lock guard(m_mutex);
if (m_pvStructure)
{
String str;