Благоја Стојкоски
2014-09-18 14:42:15 UTC
Hi guys,
I'm new to OpenSG, but I started working on a code base that was recently
ported from OpenSG 1.x (I think 1.8, but I'm not sure) to the latest code
from the repo (2.0).
After the port was done, we started getting this Warning message, about 25
times per frame:
WARNING: Unsafe change from multiple threads for FieldContainer
[PassiveWindow]:
Now, the scenario that I have is, I have 4 threads whose changes get merged
like so:
OSG::Thread::getCurrentChangeList()->merge(*my_threads[i]->getChangeList());
This is done in a for cycle that goes through all the threads. my_threads
is an array of OSG::ThreadRefPtr
After this the changes in the threads get cleared with this call:
my_threads[i]->getChangeList()->clear();
This is where the warning message appears. It gets generated in the
FieldContainer.cpp file in line 322 (
http://sourceforge.net/p/opensg/code/ci/master/tree/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp#l322
)
I managed to "fix" this by changing the clearing of the ChangeList to:
my_threads[i]->getCurrentChangeList()->clear();
However, I cannot find what is the difference between getChangeList and
getCurrentChangeList, so I can not be sure if what I did is correct. When
testing the program with this change in place, I can not spot anything
wrong, but I just want to be sure.
That's why I decided to ask you guys. Also I would like to ask you if you
could point me to some other sources of documentation or tutorials for the
latest OpenSG, apart from the wiki on http://www.opensg.org/ and the
documentation on http://opensg.fraunhofer.sg?
Thanks,
Blagoja Stojkoski
I'm new to OpenSG, but I started working on a code base that was recently
ported from OpenSG 1.x (I think 1.8, but I'm not sure) to the latest code
from the repo (2.0).
After the port was done, we started getting this Warning message, about 25
times per frame:
WARNING: Unsafe change from multiple threads for FieldContainer
[PassiveWindow]:
Now, the scenario that I have is, I have 4 threads whose changes get merged
like so:
OSG::Thread::getCurrentChangeList()->merge(*my_threads[i]->getChangeList());
This is done in a for cycle that goes through all the threads. my_threads
is an array of OSG::ThreadRefPtr
After this the changes in the threads get cleared with this call:
my_threads[i]->getChangeList()->clear();
This is where the warning message appears. It gets generated in the
FieldContainer.cpp file in line 322 (
http://sourceforge.net/p/opensg/code/ci/master/tree/Source/Base/FieldContainer/Base/OSGFieldContainer.cpp#l322
)
I managed to "fix" this by changing the clearing of the ChangeList to:
my_threads[i]->getCurrentChangeList()->clear();
However, I cannot find what is the difference between getChangeList and
getCurrentChangeList, so I can not be sure if what I did is correct. When
testing the program with this change in place, I can not spot anything
wrong, but I just want to be sure.
That's why I decided to ask you guys. Also I would like to ask you if you
could point me to some other sources of documentation or tutorials for the
latest OpenSG, apart from the wiki on http://www.opensg.org/ and the
documentation on http://opensg.fraunhofer.sg?
Thanks,
Blagoja Stojkoski