Rev | Line | |
---|
[422] | 1 | #pragma once |
---|
[425] | 2 | #include <osg/Referenced> |
---|
[422] | 3 | |
---|
[425] | 4 | |
---|
| 5 | class ThreadedWorker; |
---|
| 6 | |
---|
[422] | 7 | /** |
---|
| 8 | * \brief This class is an abstract "Thread Worker" which allows to implement tasks to be executed in a seperate thread. |
---|
| 9 | * |
---|
| 10 | * Just overload the operator() with your code you want to execute threaded in a loop. |
---|
[425] | 11 | * Each execution will be completed by the thread, if the thread is set as done/canceled during a run, the cancelation will be postponed until the execution of the functor is completed. |
---|
[422] | 12 | * |
---|
[425] | 13 | * Note: This functor will be executed in a loop until the thread is canceled or set as done=true. |
---|
[422] | 14 | * |
---|
| 15 | * @author Torben Dannhauer |
---|
| 16 | * @date Okt 2012 |
---|
| 17 | */ |
---|
[425] | 18 | class ThreadWorkerBase : public osg::Referenced |
---|
[422] | 19 | { |
---|
| 20 | public: |
---|
| 21 | ThreadWorkerBase(); |
---|
| 22 | virtual ~ThreadWorkerBase() ; |
---|
| 23 | |
---|
[425] | 24 | virtual void operator() (ThreadedWorker* threadObject) = 0; |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | |
---|
[422] | 28 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.