00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IXE_ThreadGroup_H
00025 #define IXE_ThreadGroup_H
00026
00027
00028 #include "Thread.h"
00029
00030 namespace IXE {
00031
00039 class ThreadGroup : public Lock
00040 {
00041
00042 public:
00043 ThreadGroup(char const* name, ThreadGroup* parent =
00044 Thread::CurrentThread()->Group());
00045
00046 ~ThreadGroup();
00047
00048
00049 int MaxPriority() { return maxPriority; }
00050 void MaxPriority(int prio) { maxPriority = prio; }
00051 std::string Name() { return name; }
00052 ThreadGroup* Parent() { return parent; }
00053
00054 static ThreadGroup* Root();
00055 int ActiveCount();
00056 int ActiveGroupCount();
00057 void CheckAccess();
00058 void Destroy();
00059 int Enumerate(std::vector<Thread*>& list,
00060 bool recursive = false);
00061 int Enumerate(std::vector<ThreadGroup*>& list,
00062 bool recursive = false);
00063
00064 bool ParentOf(ThreadGroup* group);
00065
00066 private:
00067 ThreadGroup();
00068 void remove(Thread* thread);
00069 void add(Thread* thread);
00070
00071 std::string name;
00072 ThreadGroup* parent;
00073 std::vector<ThreadGroup*> children;
00074 std::vector<Thread*> threads;
00075 int maxPriority;
00076 static ThreadGroup* root;
00077
00078 Locked<bool> destroying;
00079 friend class Thread;
00080 };
00081
00082 }
00083
00084 #endif //IXE_ThreadGroup_H