Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

taskmanager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           taskmanager.h  -  description
00003                              -------------------
00004     begin                : Tue Feb 12 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, taskmanager.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
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 }; // namespace NeoEngine
00111 
00112 
00113 #endif /* __NETASKMANAGER_H */
00114 

Generated on Wed Jan 21 14:21:07 2004 for NeoEngine by doxygen 1.3.5