So do I just create a thread before I enter into the main OSG event loop and just forget about the details? (hoping the answer is yes) :)

- Steve

On Tue, 19 Dec 2006, Adrian Egli wrote:

Date: Tue, 19 Dec 2006 10:17:59 +0100
From: Adrian Egli <[EMAIL PROTECTED]>
Reply-To: osg users <[email protected]>
To: osg users <[email protected]>
Subject: Re: [osg-users] Looking for a simple Threads example with OSG.

hi steve,

there is openthreads::thread an easy to use api. it's still part of
openscenegraph. you have just go through
this api. or you can juste write thread like the following pattern:

class MyThread : public OpenThreads::Thread {
public:
  MyThread() {
   m_kill = false;
   start(); //starts the thread
 }

 virtual void run() {

while ( ! m_kill ) {

    // do something in the thread

 }

}

~MyThread() {
 m_kill = true;
  join();
}

private:
  bool m_kill;

}


... adegli
2006/12/19, Steve Webb <[EMAIL PROTECTED]>:

Hello.

I'm looking to add some networking to an existing OSG app of mine.  I'm
going to need a dedicated thread for processing socket I/O.  Is there an
example of this somewhere in the OSG examples?  I tried "grep Thread
*/*.cpp" in the examples dir and I couldn't find a whole lot to work with.
Does anyone have a simple example of just opening up a viewer and spawning
a thread to count at the same time or something quick-n-dirty like that?

- Steve

--
EMAIL: (h) [EMAIL PROTECTED]  WEB: http://badcheese.com/~steve

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/



--
EMAIL: (h) [EMAIL PROTECTED]  WEB: http://badcheese.com/~steve

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to