Hello again,
Carsten Neumann wrote:
> Victor Haefner wrote:
>> I gave up mutex, I tried to work with the osg aspects and changelists
>>
>> My problem is, if I use different Aspects I need to sync them.. but then
>> the main thread will wait for all the other threads before rendering..
>> I would like to have the main thread sync the data only when the second
>> thread is allready waiting! is there a method to get the number of
>> thread which are allready waiting at a barier?
>
> no, there is no such function. However, you could add a int variable
> that is set (atomically) in your update thread to 1 and enter the
> barrier. Your render thread checks (atomically) if the value is not 0.
> In that case it performs the sync and decrements the value again.
> For practical purposes a volatile bool often works as well, although
> there are possibly cases where it may not do the right thing.
ok, now you can also query the Barrier for the number of threads that
are already waiting (Barrier::getNumWaiting()).
Examples/Tutorial/13multithreading2.cpp has been adjusted to demonstrate
that the render thread will only enter the barrier and block if the
animation thread is already waiting there (i.e. if an update to the
scene has been computed).
Cheers,
Carsten
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users