diff options
Diffstat (limited to 'Gem/develop/include/Gem/Utils/Thread.h')
-rw-r--r-- | Gem/develop/include/Gem/Utils/Thread.h | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/Gem/develop/include/Gem/Utils/Thread.h b/Gem/develop/include/Gem/Utils/Thread.h index ca861cc..3daa020 100644 --- a/Gem/develop/include/Gem/Utils/Thread.h +++ b/Gem/develop/include/Gem/Utils/Thread.h @@ -17,48 +17,53 @@ LOG #include "Gem/ExportDef.h" -namespace gem { namespace thread { - /** - * get the number of available CPUs on the system - */ - GEM_EXTERN unsigned int getCPUCount(void); - - class GEM_EXTERN Thread { - private: - class PIMPL; - PIMPL*m_pimpl; - friend class PIMPL; - - Thread(const Thread&); - Thread&operator=(const Thread&); - public: - Thread(void); - virtual ~Thread(void); - - //// - // start thread - virtual bool start(void); - //// - // stop thread - // waits for at most wait4usec microseconds - // is wait4usec==0, waits until process terminates (e.g. forever) - virtual bool stop(unsigned int wait4usec=0); - - protected: - //// - // the worker! - // get's called from an alternative thread - // if TRUE is returned, process() will be called again - // until stop() is called - // if FALSE is returned, the thread may exit - virtual bool process(void) = 0; - }; - - - //////// - // wrapper around select() or whatever - GEM_EXTERN void usleep(unsigned long usec); -};}; // namespace +namespace gem +{ +namespace thread +{ +/** + * get the number of available CPUs on the system + */ +GEM_EXTERN unsigned int getCPUCount(void); + +class GEM_EXTERN Thread +{ +private: + class PIMPL; + PIMPL*m_pimpl; + friend class PIMPL; + + Thread(const Thread&); + Thread&operator=(const Thread&); +public: + Thread(void); + virtual ~Thread(void); + + //// + // start thread + virtual bool start(void); + //// + // stop thread + // waits for at most wait4usec microseconds + // is wait4usec==0, waits until process terminates (e.g. forever) + virtual bool stop(unsigned int wait4usec=0); + +protected: + //// + // the worker! + // get's called from an alternative thread + // if TRUE is returned, process() will be called again + // until stop() is called + // if FALSE is returned, the thread may exit + virtual bool process(void) = 0; +}; + + +//////// +// wrapper around select() or whatever +GEM_EXTERN void usleep(unsigned long usec); +}; +}; // namespace |