Changeset 423 for experimental/Threading


Ignore:
Timestamp:
Oct 20, 2012, 10:25:19 PM (12 years ago)
Author:
Torben Dannhauer
Message:
 
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"
    22#include <osg/Notify>
    33
    44
    5 ChannelWorker::ChannelWorker()
     5ThreadedWorker::ThreadedWorker()
    66 : _done(false)
    77{
    8         OSG_ALWAYS<<"ChannelWorker instantiated."<<std::endl;
     8        OSG_ALWAYS<<"ThreadedWorker instantiated."<<std::endl;
    99}
    1010
    11 ChannelWorker::~ChannelWorker()
     11ThreadedWorker::~ThreadedWorker()
    1212{
    1313        cancel();
    1414}
    1515
    16 void ChannelWorker::run()
     16void ThreadedWorker::run()
    1717{
    1818        OSG_ALWAYS<<"ID "<<getThreadId()<<" running!"<<std::endl;
     
    3131}
    3232
    33 void ChannelWorker::setDone(bool done)
     33void ThreadedWorker::setDone(bool done)
    3434{
    3535        _done = done;
    3636}
    3737
    38 int ChannelWorker::cancel()
     38int ThreadedWorker::cancel()
    3939{
    40     OSG_ALWAYS<<"Cancelling ChannelWorker "<<this<<" isRunning()="<<isRunning()<<std::endl;
     40    OSG_ALWAYS<<"Cancelling ThreadedWorker "<<this<<" isRunning()="<<isRunning()<<std::endl;
    4141
    4242    if( isRunning() )
     
    5151            // commenting out debug info as it was cashing crash on exit, presumable
    5252            // 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;
    5454            OpenThreads::Thread::YieldCurrentThread();
    5555        }
    5656    }
    5757
    58     OSG_ALWAYS<<"  ChannelWorker::cancel() thread cancelled "<<this<<" isRunning()="<<isRunning()<<std::endl;
     58    OSG_ALWAYS<<"  ThreadedWorker::cancel() thread cancelled "<<this<<" isRunning()="<<isRunning()<<std::endl;
    5959
    6060    return 0;
  • experimental/Threading/Threading/ChannelWorker.h

    r422 r423  
    1010 * @date  Okt 2012
    1111 */
    12 class ChannelWorker : public osg::Referenced, public OpenThreads::Thread
     12class ThreadedWorker : public osg::Referenced, public OpenThreads::Thread
    1313{
    1414public:
    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.
    1717        virtual void run();
    1818        virtual int cancel();
Note: See TracChangeset for help on using the changeset viewer.