source: experimental/Threading/Threading/ThreadedWorker.h @ 424

Last change on this file since 424 was 424, checked in by Torben Dannhauer, 12 years ago
File size: 776 bytes
Line 
1#pragma once
2
3#include <osg/Referenced>
4#include <OpenThreads/Thread>
5
6/**
7 * \brief This class is a Thread Object which allows to create Functors and attach them to this thread object.
8 *
9 * @author Torben Dannhauer
10 * @date  Okt 2012
11 */ 
12class ThreadedWorker : public osg::Referenced, public OpenThreads::Thread
13{
14public:
15        ThreadedWorker() ;
16        ~ThreadedWorker();      //Destroying the thread object will implicit call cancel(), then the function will block until the thread has finished.
17        virtual void run();
18        virtual int cancel();
19       
20        void setDone(bool done);        // sinbgals the thread to stop but returns immediately. Use cancel if you want to wait blocking until the thread is canceled.
21        bool getDone() const { return _done; } 
22
23private:
24        bool _done;
25};
Note: See TracBrowser for help on using the repository browser.