Changeset 423
- Timestamp:
- Oct 20, 2012, 10:25:19 PM (12 years ago)
- Location:
- experimental/Threading/Threading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/Threading/Threading/ChannelWorker.cpp
r422 r423 1 #include " ChannelWorker.h"1 #include "ThreadedWorker.h" 2 2 #include <osg/Notify> 3 3 4 4 5 ChannelWorker::ChannelWorker()5 ThreadedWorker::ThreadedWorker() 6 6 : _done(false) 7 7 { 8 OSG_ALWAYS<<" ChannelWorker instantiated."<<std::endl;8 OSG_ALWAYS<<"ThreadedWorker instantiated."<<std::endl; 9 9 } 10 10 11 ChannelWorker::~ChannelWorker()11 ThreadedWorker::~ThreadedWorker() 12 12 { 13 13 cancel(); 14 14 } 15 15 16 void ChannelWorker::run()16 void ThreadedWorker::run() 17 17 { 18 18 OSG_ALWAYS<<"ID "<<getThreadId()<<" running!"<<std::endl; … … 31 31 } 32 32 33 void ChannelWorker::setDone(bool done)33 void ThreadedWorker::setDone(bool done) 34 34 { 35 35 _done = done; 36 36 } 37 37 38 int ChannelWorker::cancel()38 int ThreadedWorker::cancel() 39 39 { 40 OSG_ALWAYS<<"Cancelling ChannelWorker "<<this<<" isRunning()="<<isRunning()<<std::endl;40 OSG_ALWAYS<<"Cancelling ThreadedWorker "<<this<<" isRunning()="<<isRunning()<<std::endl; 41 41 42 42 if( isRunning() ) … … 51 51 // commenting out debug info as it was cashing crash on exit, presumable 52 52 // due to OSG_NOTIFY or std::cout destructing earlier than this destructor. 53 //OSG_ALWAYS<<" Waiting for ChannelWorker to cancel "<<this<<std::endl;53 //OSG_ALWAYS<<" Waiting for ThreadedWorker to cancel "<<this<<std::endl; 54 54 OpenThreads::Thread::YieldCurrentThread(); 55 55 } 56 56 } 57 57 58 OSG_ALWAYS<<" ChannelWorker::cancel() thread cancelled "<<this<<" isRunning()="<<isRunning()<<std::endl;58 OSG_ALWAYS<<" ThreadedWorker::cancel() thread cancelled "<<this<<" isRunning()="<<isRunning()<<std::endl; 59 59 60 60 return 0; -
experimental/Threading/Threading/ChannelWorker.h
r422 r423 10 10 * @date Okt 2012 11 11 */ 12 class ChannelWorker : public osg::Referenced, public OpenThreads::Thread12 class ThreadedWorker : public osg::Referenced, public OpenThreads::Thread 13 13 { 14 14 public: 15 ChannelWorker() ;16 ~ ChannelWorker(); //Destroying the thread object will implicit call cancel(), then the function will block until the thread has finished.15 ThreadedWorker() ; 16 ~ThreadedWorker(); //Destroying the thread object will implicit call cancel(), then the function will block until the thread has finished. 17 17 virtual void run(); 18 18 virtual int cancel();
Note: See TracChangeset
for help on using the changeset viewer.