Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 16, 2008, 8:45:13 PM (16 years ago)
Author:
rgrieder
Message:

Changed initialisation of TclThreadManager, TclBind and Shell to match the simple singleton concept (runtime assert in the c'tor).
That simplifies things a lot. The instances now 'belong' to GSRoot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/TclThreadManager.cc

    r1786 r1792  
    2727 */
    2828
     29#include "TclThreadManager.h"
     30
    2931#include <iostream>
    3032#include <string>
    31 
    3233#include <boost/thread/thread.hpp>
    3334#include <boost/bind.hpp>
    34 
    3535#include <OgreTimer.h>
    3636
     
    3939#include "CommandExecutor.h"
    4040#include "TclBind.h"
    41 #include "TclThreadManager.h"
    4241#include "util/Debug.h"
    4342#include "util/Convert.h"
     
    5958    SetConsoleCommand(TclThreadManager, flush,   false).argumentCompleter(0, autocompletion::tclthreads());
    6059
    61     TclThreadManager::TclThreadManager()
     60    TclThreadManager* TclThreadManager::singletonRef_s = 0;
     61
     62    TclThreadManager::TclThreadManager(Tcl::interpreter* interpreter)
    6263    {
    6364        RegisterRootObject(TclThreadManager);
     65
     66        assert(singletonRef_s == 0);
     67        singletonRef_s = this;
    6468
    6569        this->threadCounter_ = 0;
    6670        this->orxonoxInterpreterBundle_.id_ = 0;
    67         this->orxonoxInterpreterBundle_.interpreter_ = TclBind::getInstance().getTclInterpreter();
     71        this->orxonoxInterpreterBundle_.interpreter_ = interpreter;
    6872#if (BOOST_VERSION >= 103500)
    6973        this->threadID_ = boost::this_thread::get_id();
     
    8488        }
    8589        this->destroy(threadID);
    86     }
    87 
    88     TclThreadManager& TclThreadManager::getInstance()
    89     {
    90         static TclThreadManager instance;
    91         return instance;
     90
     91        singletonRef_s = 0;
    9292    }
    9393
Note: See TracChangeset for help on using the changeset viewer.