Hi,

without much thinking, so I might miss a crucial point, you can
derive from OSG::Thread, and call run with only the aspect given
which in turn calls the virtual workProc function you can overload
in your derived class. An example can be found in
Source/System/FieldContainer/testDerivedThread.cpp.

gerrit

On Mon, 2003-12-08 at 07:09, Gabriel Zachmann wrote:
> The following might be more a question concerning C++, but anyway ...
> 
> I have a piece of code running on top of OpenSG.
> It's got sort of it's own main loop, which can run concurrently to the rest
> of the app.
> 
> Until now, I started this using 
> 
> void runConcurrently( int processor )
> {
>     ...
>     thread->runFunction( mainLoop, NULL);
>     ...
> }
> 
> Here, both runConcurrently() and mainLoop() are global functions.
> 
> Now, I would like to turn both runConcurrently() and mainLoop() into
> instance methods (non-static member functions) of a class, of which several
> instances can exist, and whose main loops could all run concurrently.
> 
> The question is: what would be the cleanest way to do this?
> 
> I could keep mainLoop() as a global function and introduce a parameter,
> which would hold a pointer to the object.
> 
> Are there better solutions?
> 
> All kinds of comments will be appreciated,
> 
> Gabriel.



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to