00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __XVR2_THREAD_MANAGER_H__
00015 #define __XVR2_THREAD_MANAGER_H__
00016
00017 #include<xvr2/CoreExceptions.h>
00018 #include<xvr2/InvalidParameterException.h>
00019 #include<xvr2/Threading.h>
00020 #include<xvr2/Thread.h>
00021 #include<xvr2/JoinableThread.h>
00022 #include<xvr2/BackgroundFunction.h>
00023
00024 namespace xvr2 {
00025
00029 class ThreadManager:public Threading {
00030 private:
00031 protected:
00032 public:
00035 static void start(Thread *t);
00036 static void start(Thread &t);
00040 static void start(Thread *t, const SchedPolicy pol);
00041 static void start(Thread &t, const SchedPolicy pol);
00046 static UInt64 start(BackgroundFunction &bf, bool waitfor = true);
00049 static bool isRunning(Thread *t);
00053 static Thread *getCurrentThread();
00057 static BackgroundFunction *getCurrentBackgroundFunction();
00064 static const UInt64 getCurrentThreadID();
00069 static unsigned int activeCount();
00074 static UInt64 numericID(const Thread *t);
00079 static UInt64 numericID(const Thread &t);
00086 static void join(JoinableThread *t);
00093 static void join(JoinableThread &t);
00102 static void detach(JoinableThread *t);
00111 static void detach(JoinableThread &t);
00112 static Threading::SchedPolicy getSchedulingPolicy(Thread *t);
00113 static Threading::SchedPolicy getSchedulingPolicy(Thread &t);
00114 static void setSchedulingPolicy(Thread *t, Threading::SchedPolicy pol);
00115 static void setSchedulingPolicy(Thread &t, Threading::SchedPolicy pol);
00116 static void setSchedulingParams(Thread *t, Threading::SchedPolicy pol, int prio);
00117 static void setSchedulingParams(Thread &t, Threading::SchedPolicy pol, int prio);
00118 static void setPriority(Thread *t, int prio);
00119 static void setPriority(Thread &t, int prio);
00120
00123 static bool currentIsThread();
00124
00127 static bool currentIsBackgroundFunction();
00128
00133 static bool currentIsMain();
00134
00141 static void testCancellation();
00142 };
00143
00144 }
00145
00146
00147 #endif