00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NETASKMANAGER_H
00028 #define __NETASKMANAGER_H
00029
00030
00031 #include "base.h"
00032 #include "mutex.h"
00033 #include "thread.h"
00034
00035 #include <vector>
00036
00037
00043 namespace NeoEngine
00044 {
00045
00046
00047 #ifdef WIN32
00048 # ifdef _MSC_VER
00049 # pragma warning( disable : 4231 )
00050 # endif
00051 # ifndef __HAVE_VECTOR_THREAD
00052 UDTVectorEXPIMP( class Thread* );
00053 # define __HAVE_VECTOR_THREAD
00054 # endif
00055 # ifndef __HAVE_VECTOR_THREADMETHOD
00056 UDTVectorEXPIMP( class ThreadMethod* );
00057 # define __HAVE_VECTOR_THREADMETHOD
00058 # endif
00059 #endif
00060
00061
00066 class NEOENGINE_API TaskManager : public MutexObject
00067 {
00068 friend class Thread;
00069
00070 protected:
00071
00073 std::vector< Thread* > m_vpkThreads;
00074
00076 std::vector< ThreadMethod* > m_vpkQueue;
00077
00079 unsigned int m_iMaxThreads;
00080
00081
00086 void Remove( Thread *pkThread );
00087
00088
00089 public:
00090
00095 TaskManager( int iWorkerThreads );
00096
00100 virtual ~TaskManager();
00101
00106 void Schedule( ThreadMethod *pkTask );
00107 };
00108
00109
00110 };
00111
00112
00113 #endif
00114