aboutsummaryrefslogtreecommitdiff
path: root/Gem/develop/include/Gem/Utils/Thread.h
diff options
context:
space:
mode:
authorTravis CI <zmoelnig@travis-ci.umlaeute.mur.at>2015-03-14 20:40:49 +0000
committerTravis CI <zmoelnig@travis-ci.umlaeute.mur.at>2015-03-14 20:40:49 +0000
commit5c694f159b012d1d94bf15bfe580dec52e4fe797 (patch)
treece400f82d72f92189c50f54afa11c568cda53562 /Gem/develop/include/Gem/Utils/Thread.h
Gem osx/x86_64
built '' for osx/x86_64
Diffstat (limited to 'Gem/develop/include/Gem/Utils/Thread.h')
-rw-r--r--Gem/develop/include/Gem/Utils/Thread.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/Gem/develop/include/Gem/Utils/Thread.h b/Gem/develop/include/Gem/Utils/Thread.h
new file mode 100644
index 0000000..ca861cc
--- /dev/null
+++ b/Gem/develop/include/Gem/Utils/Thread.h
@@ -0,0 +1,66 @@
+/*-----------------------------------------------------------------
+LOG
+ GEM - Graphics Environment for Multimedia
+
+ Thread.h
+ - part of GEM
+ - simple platform independent thread abstraction
+
+ Copyright (c) 2011-2012 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
+ For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+
+-----------------------------------------------------------------*/
+
+#ifndef _INCLUDE__GEM_GEM_THREAD_H_
+#define _INCLUDE__GEM_GEM_THREAD_H_
+
+#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
+
+
+
+
+#endif /* _INCLUDE__GEM_GEM_THREAD_H_ */