#pragma once #include #include class ChannelWorker : public osg::Referenced, public OpenThreads::Thread { public: ChannelWorker() ; ~ChannelWorker(); //Destroying the thread object will implicit call cancel(), then the function will block until the thread has finished. virtual void run(); virtual int cancel(); 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. bool getDone() const { return _done; } private: bool _done; };