Index: /code/branches/netp6/src/core/CMakeLists.txt
===================================================================
--- /code/branches/netp6/src/core/CMakeLists.txt	(revision 3229)
+++ /code/branches/netp6/src/core/CMakeLists.txt	(revision 3230)
@@ -61,4 +61,8 @@
   TclBind.cc
   TclThreadManager.cc
+  
+  # multithreading
+  Thread.cc
+  ThreadPool.cc
 )
 ADD_SUBDIRECTORY(input)
Index: /code/branches/netp6/src/core/CorePrereqs.h
===================================================================
--- /code/branches/netp6/src/core/CorePrereqs.h	(revision 3229)
+++ /code/branches/netp6/src/core/CorePrereqs.h	(revision 3230)
@@ -186,4 +186,8 @@
     class SimpleCommand;
     class SimpleInputState;
+
+    // multithreading
+    class Thread;
+    class ThreadGroup;
 }
 
@@ -196,10 +200,14 @@
 
 // Boost
-namespace boost { namespace filesystem
-{
-    struct path_traits;
-    template <class String, class Traits> class basic_path;
-    typedef basic_path<std::string, path_traits> path;
-} }
+namespace boost { 
+    namespace filesystem
+    {
+        struct path_traits;
+        template <class String, class Traits> class basic_path;
+        typedef basic_path<std::string, path_traits> path;
+    } 
+    class thread;
+    class mutex;
+}
 
 // TinyXML and TinyXML++
Index: /code/branches/netp6/src/core/Thread.cc
===================================================================
--- /code/branches/netp6/src/core/Thread.cc	(revision 3230)
+++ /code/branches/netp6/src/core/Thread.cc	(revision 3230)
@@ -0,0 +1,105 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Thread.h"
+
+#include <cassert>
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread_time.hpp>
+
+#include "core/Functor.h"
+#include "util/Sleep.h"
+
+namespace orxonox
+{
+    boost::posix_time::millisec THREAD_WAIT_BEFORE_DETACH(1000);
+    
+    
+    Thread::Thread():
+        functor_(0),
+        isWorking_(false),
+        stopThread_(false)
+    {
+        this->communicationMutex_ = new boost::mutex;
+        this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) );
+    }
+    
+    Thread::~Thread()
+    {
+        this->stopThread_ = true;
+        if( !this->workerThread_->timed_join( THREAD_WAIT_BEFORE_DETACH ) )
+            assert(0); // this should not happen
+        delete this->workerThread_;
+        delete this->communicationMutex_;
+    }
+    
+    bool Thread::evaluateFunctor( Functor* functor )
+    {
+        if( this->communicationMutex_->try_lock() )
+        {
+            this->functor_ = functor;
+            this->communicationMutex_->unlock();
+            return true;
+        }
+        else
+            return false;
+    }
+    
+    void Thread::threadLoop()
+    {
+        while( !this->stopThread_ )
+        {
+            this->communicationMutex_->lock();
+            if( this->functor_ )
+            {
+                (*this->functor_)();
+                this->communicationMutex_->unlock();
+            }
+            else
+            {
+                this->communicationMutex_->unlock();
+                this->workerThread_->yield();
+            }
+        }
+    }
+    
+    void Thread::waitUntilFinished()
+    {
+        bool stillWorking = true;
+        while( stillWorking )
+        {
+            this->communicationMutex_->lock();
+            stillWorking = this->isWorking_;
+            this->communicationMutex_->unlock();
+            if( stillWorking )
+                msleep( 1 );
+        }
+    }
+}
Index: /code/branches/netp6/src/core/Thread.h
===================================================================
--- /code/branches/netp6/src/core/Thread.h	(revision 3230)
+++ /code/branches/netp6/src/core/Thread.h	(revision 3230)
@@ -0,0 +1,61 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Thread_H__
+#define _Thread_H__
+
+
+#include "CorePrereqs.h"
+
+ namespace orxonox
+{
+    
+    class Thread
+    {
+    public:
+        Thread();
+        virtual ~Thread();
+        
+        inline  bool isWorking(){ return this->isWorking_; }
+        void waitUntilFinished();
+        bool evaluateFunctor( Functor* functor );
+        
+    private:
+        void            threadLoop();
+        
+        Functor*        functor_;
+        bool            isWorking_;
+        bool            stopThread_;
+        boost::thread*  workerThread_;
+        boost::mutex*   communicationMutex_;
+    };
+    
+}
+
+
+#endif
Index: /code/branches/netp6/src/core/ThreadPool.cc
===================================================================
--- /code/branches/netp6/src/core/ThreadPool.cc	(revision 3230)
+++ /code/branches/netp6/src/core/ThreadPool.cc	(revision 3230)
@@ -0,0 +1,109 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ThreadPool.h"
+
+#include <cassert>
+
+
+namespace orxonox
+{
+    
+    
+    ThreadPool::ThreadPool()
+    {
+    }
+    
+    ThreadPool::~ThreadPool()
+    {
+    }
+    
+    void ThreadPool::addThreads( unsigned int nr )
+    {
+        for( unsigned int i=0; i<nr; i++ )
+            this->threadPool_.push_back(Thread());
+    }
+    unsigned int ThreadPool::removeThreads( unsigned int nr )
+    {
+        unsigned int i=0;
+        std::vector<Thread>::iterator it;
+        for( it = this->threadPool_.begin(); it != threadPool_.end() && i<nr; ++it )
+        {
+            if( ! it->isWorking() )
+            {
+                this->threadPool_.erase( it++ );
+                ++i;
+            }
+        }
+    }
+    unsigned int ThreadPool::setNrOfThreads( unsigned int nr )
+    {
+        unsigned int currentsize = this->threadPool_.size();
+        if ( nr < currentsize )
+            return currentsize - removeThreads( currentsize - nr );
+        else if ( nr == currentsize )
+            return currentsize;
+        else
+        {
+            addThreads( nr - currentsize );
+            return nr;
+        }
+    }
+    
+    bool ThreadPool::passFunction( Functor* functor, bool addThread )
+    {
+        std::vector<Thread>::iterator it;
+        for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
+        {
+            if ( ! it->isWorking() )
+            {
+                bool b = it->evaluateFunctor( functor );
+                assert(b); // if b is false then there is some code error
+                return true;
+            }
+        }
+        if ( addThread )
+        {
+            addThreads( 1 );
+            this->threadPool_.back().evaluateFunctor( functor ); // access the last element
+            return true;
+        }
+        else
+            return false;
+    }
+    
+    void ThreadPool::synchronise()
+    {
+        std::vector<Thread>::iterator it;
+        for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
+        {
+            it->waitUntilFinished();
+        }
+    }
+
+}
Index: /code/branches/netp6/src/core/ThreadPool.h
===================================================================
--- /code/branches/netp6/src/core/ThreadPool.h	(revision 3230)
+++ /code/branches/netp6/src/core/ThreadPool.h	(revision 3230)
@@ -0,0 +1,60 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oliver Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ThreadPool_H__
+#define _ThreadPool_H__
+
+#include <vector>
+
+#include "Thread.h"
+
+ namespace orxonox
+{
+    
+    class ThreadPool
+    {
+    public:
+        ThreadPool();
+        virtual ~ThreadPool();
+        
+        void addThreads( unsigned int nr );
+        unsigned int removeThreads( unsigned int nr );
+        unsigned int setNrOfThreads( unsigned int nr );
+        
+        bool passFunction( Functor* functor, bool addThread=false );
+        void synchronise();
+        
+    private:
+        std::vector<Thread>     threadPool_;
+        
+    };
+    
+}
+
+
+#endif
Index: /code/branches/netp6/src/util/CMakeLists.txt
===================================================================
--- /code/branches/netp6/src/util/CMakeLists.txt	(revision 3229)
+++ /code/branches/netp6/src/util/CMakeLists.txt	(revision 3230)
@@ -31,6 +31,4 @@
   String.cc
   SubString.cc
-  Thread.cc
-  ThreadPool.cc
 )
 
Index: de/branches/netp6/src/util/Thread.cc
===================================================================
--- /code/branches/netp6/src/util/Thread.cc	(revision 3229)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oliver Scheuss
- *   Co-authors:
- *      ...
- *
- */
-
-#include "Thread.h"
-
-#include <cassert>
-#include <boost/thread/thread.hpp>
-#include <boost/bind.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread_time.hpp>
-
-#include "core/Functor.h"
-#include "util/Sleep.h"
-
-namespace orxonox
-{
-    boost::posix_time::millisec THREAD_WAIT_BEFORE_DETACH(1000);
-    
-    
-    Thread::Thread():
-        functor_(0),
-        isWorking_(false),
-        stopThread_(false)
-    {
-        this->communicationMutex_ = new boost::mutex;
-        this->workerThread_ = new boost::thread( boost::bind(&Thread::threadLoop, this) );
-    }
-    
-    Thread::~Thread()
-    {
-        this->stopThread_ = true;
-        if( !this->workerThread_->timed_join( THREAD_WAIT_BEFORE_DETACH ) )
-            assert(0); // this should not happen
-        delete this->workerThread_;
-        delete this->communicationMutex_;
-    }
-    
-    bool Thread::evaluateFunctor( Functor* functor )
-    {
-        if( this->communicationMutex_->try_lock() )
-        {
-            this->functor_ = functor;
-            this->communicationMutex_->unlock();
-            return true;
-        }
-        else
-            return false;
-    }
-    
-    void Thread::threadLoop()
-    {
-        while( !this->stopThread_ )
-        {
-            this->communicationMutex_->lock();
-            if( this->functor_ )
-            {
-                (*this->functor_)();
-                this->communicationMutex_->unlock();
-            }
-            else
-            {
-                this->communicationMutex_->unlock();
-                this->workerThread_->yield();
-            }
-        }
-    }
-    
-    void Thread::waitUntilFinished()
-    {
-        bool stillWorking = true;
-        while( stillWorking )
-        {
-            this->communicationMutex_->lock();
-            stillWorking = this->isWorking_;
-            this->communicationMutex_->unlock();
-            if( stillWorking )
-                msleep( 1 );
-        }
-    }
-}
Index: de/branches/netp6/src/util/Thread.h
===================================================================
--- /code/branches/netp6/src/util/Thread.h	(revision 3229)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oliver Scheuss
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _Thread_H__
-#define _Thread_H__
-
-
-#include "UtilPrereqs.h"
-#include "core/CorePrereqs.h"
-
- namespace orxonox
-{
-    
-    class Thread
-    {
-    public:
-        Thread();
-        virtual ~Thread();
-        
-        inline  bool isWorking(){ return this->isWorking_; }
-        void waitUntilFinished();
-        bool evaluateFunctor( Functor* functor );
-        
-    private:
-        void            threadLoop();
-        
-        Functor*        functor_;
-        bool            isWorking_;
-        bool            stopThread_;
-        boost::thread*  workerThread_;
-        boost::mutex*   communicationMutex_;
-    };
-    
-}
-
-
-#endif
Index: de/branches/netp6/src/util/ThreadPool.cc
===================================================================
--- /code/branches/netp6/src/util/ThreadPool.cc	(revision 3229)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oliver Scheuss
- *   Co-authors:
- *      ...
- *
- */
-
-#include "ThreadPool.h"
-
-#include <cassert>
-
-
-namespace orxonox
-{
-    
-    
-    ThreadPool::ThreadPool()
-    {
-    }
-    
-    ThreadPool::~ThreadPool()
-    {
-    }
-    
-    void ThreadPool::addThreads( unsigned int nr )
-    {
-        for( unsigned int i=0; i<nr; i++ )
-            this->threadPool_.push_back(Thread());
-    }
-    unsigned int ThreadPool::removeThreads( unsigned int nr )
-    {
-        unsigned int i=0;
-        std::vector<Thread>::iterator it;
-        for( it = this->threadPool_.begin(); it != threadPool_.end() && i<nr; ++it )
-        {
-            if( ! it->isWorking() )
-            {
-                this->threadPool_.erase( it++ );
-                ++i;
-            }
-        }
-    }
-    unsigned int ThreadPool::setNrOfThreads( unsigned int nr )
-    {
-        unsigned int currentsize = this->threadPool_.size();
-        if ( nr < currentsize )
-            return currentsize - removeThreads( currentsize - nr );
-        else if ( nr == currentsize )
-            return currentsize;
-        else
-        {
-            addThreads( nr - currentsize );
-            return nr;
-        }
-    }
-    
-    bool ThreadPool::passFunction( Functor* functor, bool addThread )
-    {
-        std::vector<Thread>::iterator it;
-        for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
-        {
-            if ( ! it->isWorking() )
-            {
-                bool b = it->evaluateFunctor( functor );
-                assert(b); // if b is false then there is some code error
-                return true;
-            }
-        }
-        if ( addThread )
-        {
-            addThreads( 1 );
-            this->threadPool_.back().evaluateFunctor( functor ); // access the last element
-            return true;
-        }
-        else
-            return false;
-    }
-    
-    void ThreadPool::synchronise()
-    {
-        std::vector<Thread>::iterator it;
-        for ( it=this->threadPool_.begin(); it!=this->threadPool_.end(); ++it )
-        {
-            it->waitUntilFinished();
-        }
-    }
-
-}
Index: de/branches/netp6/src/util/ThreadPool.h
===================================================================
--- /code/branches/netp6/src/util/ThreadPool.h	(revision 3229)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Oliver Scheuss
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _ThreadPool_H__
-#define _ThreadPool_H__
-
-#include <vector>
-
-#include "UtilPrereqs.h"
-#include "Thread.h"
-
- namespace orxonox
-{
-    
-    class ThreadPool
-    {
-    public:
-        ThreadPool();
-        virtual ~ThreadPool();
-        
-        void addThreads( unsigned int nr );
-        unsigned int removeThreads( unsigned int nr );
-        unsigned int setNrOfThreads( unsigned int nr );
-        
-        bool passFunction( Functor* functor, bool addThread=false );
-        void synchronise();
-        
-    private:
-        std::vector<Thread>     threadPool_;
-        
-    };
-    
-}
-
-
-#endif
Index: /code/branches/netp6/src/util/UtilPrereqs.h
===================================================================
--- /code/branches/netp6/src/util/UtilPrereqs.h	(revision 3229)
+++ /code/branches/netp6/src/util/UtilPrereqs.h	(revision 3230)
@@ -60,9 +60,4 @@
 // Forward declarations
 //-----------------------------------------------------------------------
-namespace boost
-{
-    class thread;
-    class mutex;
-}
 
 namespace Ogre
@@ -101,6 +96,4 @@
     class SignalHandler;
     class SubString;
-    class Thread;
-    class ThreadPool;
 }
 
