Hello Thomas,

Thomas Kulessa wrote:
> I am working on an OpenSG app, which has an OSC (OpenSoundControl)
> network interface to control the scene graph (like "show/hide node" or
> "transform node"). To speed it up I want to separate the main app loop
> and OSC handling in two different OpenSG threads.
> Problem is, I am not able to start the OSC handler thread with a another
> aspect than 0. The main thread works on aspect 0. When I create the
> second thread with
> 
> osc_thread = 
>   dynamic_cast<Thread *>(ThreadManager::the()->getThread("OSC thread"));
> osc_thread->runFunction(thread_func, 1, NULL);
> 
> which should start the osc thread with aspect 1 and then call
> 
> osc_thread->getAspect()
> 
> it returns 0.

yes, getAspect() is actually a static member function of Thread that 
returns the aspect of the currently running thread and since you call it 
from the 'main' thread you get aspect 0. Try calling it from your 
thread_func, it should return 1 there.

> ThreadManager::the()->getNumAspects() returns 2 and a
> value bigger 1 in runFunction for the aspect parameter leads, as it
> should, to an exception.
> Am I missing something? The tutorial doesn't help, it works on one
> aspect only.

take a look at Doc/tutorial/progs/13multithreading2.cpp, it uses a 
thread on aspect 1 to spin an object.

        Cheers,
                Carsten


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to