CDRMonitor: lazy node creation

This commit is contained in:
Michael Davidsaver
2011-02-08 13:28:02 -05:00
parent 29bbaa60f6
commit 7d3e58fcc9
3 changed files with 39 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ public :
FieldPvt::FieldPvt(String fieldName,Type type)
: fieldName(fieldName),type(type),referenceCount(1)
{field_node.incRef();}
{PVDATA_REFCOUNT_MONITOR_INCREF(field);}
static Mutex refCountMutex;
@@ -69,7 +69,7 @@ void Field::renameField(String newName)
}
void Field::incReferenceCount() const {
field_node.incRef();
PVDATA_REFCOUNT_MONITOR_INCREF(field);
Lock xx(&refCountMutex);
pImpl->referenceCount++;
if(pImpl->type!=structure) return;
@@ -82,7 +82,7 @@ void Field::incReferenceCount() const {
}
void Field::decReferenceCount() const {
field_node.decRef();
PVDATA_REFCOUNT_MONITOR_DECREF(field);
Lock xx(&refCountMutex);
if(pImpl->referenceCount<=0) {
String message("logicError field ");