pvRequest must be destroyed by a client code

This commit is contained in:
Matej Sekoranja
2011-02-09 22:19:14 +01:00
parent e5910b2efc
commit dff724cbb5
2 changed files with 15 additions and 8 deletions
@@ -262,11 +262,13 @@ namespace epics {
virtual void acquire() {
Lock guard(&m_mutex);
m_refCount++;
printf("acquire %d\n", m_refCount);
}
virtual void release() {
m_mutex.lock();
m_refCount--;
printf("release %d\n", m_refCount);
m_mutex.unlock();
if (m_refCount == 0)
delete this;
@@ -303,7 +305,7 @@ namespace epics {
~ChannelProcessRequestImpl()
{
PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelProcess);
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
}
public:
@@ -422,7 +424,7 @@ namespace epics {
// synced by code calling this
if (m_data) delete m_data;
if (m_bitSet) delete m_bitSet;
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
}
public:
@@ -567,7 +569,7 @@ namespace epics {
// synced by code calling this
if (m_data) delete m_data;
if (m_bitSet) delete m_bitSet;
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
}
public:
@@ -739,7 +741,7 @@ namespace epics {
// synced by code calling this
if (m_putData) delete m_putData;
if (m_getData) delete m_getData;
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
}
public:
@@ -954,7 +956,7 @@ namespace epics {
// synced by code calling this
if (m_data) delete m_data;
if (m_bitSet) delete m_bitSet;
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
}
public:
@@ -1102,7 +1104,7 @@ namespace epics {
PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelArray);
// synced by code calling this
if (m_data) delete m_data;
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
}
public:
@@ -1481,7 +1483,7 @@ namespace epics {
PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelMonitor);
// synced by code calling this
if (m_pvRequest) delete m_pvRequest;
//if (m_pvRequest) delete m_pvRequest;
// uncomment when m_pvStructure not destroyed if (m_structure) m_structure->decReferenceCount();
// TODO temp
+6 -1
View File
@@ -489,7 +489,7 @@ int main(int argc,char *argv[])
epicsThreadSleep ( 3.0 );
channelGet->destroy();
epicsThreadSleep ( 1.0 );
delete pvRequest;
ChannelPutRequesterImpl channelPutRequesterImpl;
pvRequest = getCreateRequest()->createRequest("field(value,timeStamp)",&channelPutRequesterImpl);
@@ -500,6 +500,7 @@ int main(int argc,char *argv[])
channelPut->put(false);
epicsThreadSleep ( 1.0 );
channelPut->destroy();
delete pvRequest;
ChannelPutGetRequesterImpl channelPutGetRequesterImpl;
pvRequest = getCreateRequest()->createRequest("putField(value,timeStamp)getField(timeStamp)",&channelPutGetRequesterImpl);
@@ -512,6 +513,7 @@ int main(int argc,char *argv[])
channelPutGet->putGet(false);
epicsThreadSleep ( 1.0 );
channelPutGet->destroy();
delete pvRequest;
ChannelRPCRequesterImpl channelRPCRequesterImpl;
@@ -521,6 +523,7 @@ int main(int argc,char *argv[])
channelRPC->request(false);
epicsThreadSleep ( 1.0 );
channelRPC->destroy();
delete pvRequest;
ChannelArrayRequesterImpl channelArrayRequesterImpl;
//pvRequest = getCreateRequest()->createRequest("value",&channelArrayRequesterImpl);
@@ -538,6 +541,7 @@ int main(int argc,char *argv[])
channelArray->setLength(false,3,4);
epicsThreadSleep ( 1.0 );
channelArray->destroy();
delete pvRequest;
MonitorRequesterImpl monitorRequesterImpl;
pvRequest = getCreateRequest()->createRequest("field()",&monitorRequesterImpl);
@@ -557,6 +561,7 @@ int main(int argc,char *argv[])
monitor->destroy();
delete pvRequest;
epicsThreadSleep ( 3.0 );
printf("Destroying channel... \n");