Hello all,
we've run into a problem with our app that runs multiple threads on one
aspect when connecting it to a cluster server.
Consider the following scenario:
Thread A:
- changes field F0 in container C
in FC::registerChangedContainer _pContainerChanges points to an entry in
the CL of Thread A.
- commitChanges();
Thread B:
- changes field F1 in container C
because of the commitChanges _bvChanges == 0x00
so FC::registerChangedContainer runs, but only puts an uncommitted
change for F1 into the CL of Thread B.
- commitChanges();
The change to F1 will not be transmitted over the cluster, because it is
lost after the commitChanges clears the uncommitedChanges list of the CL
of Thread B.
Attached is a patch that changes the behaviour of
FC::registerChangedContainer() to only skip creation of a new CL entry
if _pContainerChanges points into the current thread's CL.
Comments? Other ideas to solve this?
Cheers,
Carsten
diff --git a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
index dcaaf57..27e2f1e 100644
--- a/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
+++ b/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp
@@ -274,17 +274,20 @@ void FieldContainer::registerChangedContainer(void)
// osgSpinLock(&_uiContainerId, SpinLockBit);
- if(_pContainerChanges == NULL)
+ ChangeList *pCL = Thread::getCurrentChangeList();
+
+ if(_pContainerChanges == NULL ||
+ _pContainerChanges->pList != pCL )
{
- _pContainerChanges = Thread::getCurrentChangeList()->getNewEntry();
+ _pContainerChanges = pCL->getNewEntry();
- _pContainerChanges->uiEntryDesc = ContainerChangeEntry::Change;
- _pContainerChanges->pFieldFlags = _pFieldFlags;
- _pContainerChanges->uiContainerId = this->getId();
+ _pContainerChanges->uiEntryDesc = ContainerChangeEntry::Change;
+ _pContainerChanges->pFieldFlags = _pFieldFlags;
+ _pContainerChanges->uiContainerId = this->getId();
_pContainerChanges->bvUncommittedChanges = &_bvChanged;
}
- Thread::getCurrentChangeList()->addUncommited(_pContainerChanges);
+ pCL->addUncommited(_pContainerChanges);
// osgSpinLockRelease(&_uiContainerId, SpinLockClearMask);
}
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core