Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 8, 2008, 1:46:05 AM (17 years ago)
Author:
landauf
Message:

several changes in TclThreadManager but couldn't yet fix the bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/core/TclThreadManager.h

    r1230 r1247  
    4545    struct TclThread
    4646    {
     47        unsigned int threadID_;
    4748        Tcl::interpreter* interpreter_;
    4849        boost::thread* thread_;
    49         boost::try_mutex* mutex_;
     50        boost::mutex* evalMutex_;
     51        boost::mutex* stateMutex_;
     52        enum State
     53        {
     54            Ready,
     55            Busy,
     56            Finished,
     57            Error
     58        }* state_;
    5059    };
    5160
     
    6069            static void execute(unsigned int threadID, const std::string& command);
    6170            static std::string query(unsigned int threadID, const std::string& command);
     71            static void status();
     72            static void dump(unsigned int threadID);
    6273
     74            static std::string tcl_query(int id, Tcl::object const &args);
    6375            static void tcl_execute(Tcl::object const &args);
    64             static std::string tcl_orxonox(Tcl::object const &args);
    6576
    6677            Tcl::interpreter* createTclInterpreter(unsigned int threadID) const;
    6778            bool createTclThread();
    6879            bool destroyTclThread(unsigned int threadID);
     80
     81            void setState(TclThread* tclThread, TclThread::State state);
     82            TclThread::State getState(TclThread* tclThread);
    6983
    7084            void pushCommandBack(const std::string& command);
     
    8599
    86100            bool isReady_;
     101            bool isQuerying_;
     102            unsigned int queryID_;
    87103
    88104            unsigned int IDcount_;
    89             std::map<unsigned int, TclThread> threads_;
    90             std::map<unsigned int, std::queue<std::string> > threadQueues_;
     105            std::map<unsigned int, TclThread*> threads_;
     106            std::map<unsigned int, std::pair<std::queue<std::string>, boost::condition*> > threadQueues_;
    91107            std::queue<std::string> orxonoxQueue_;
    92108
    93             boost::mutex orxonoxQueueMutex_;
    94             boost::mutex threadQueuesMutex_;
    95             boost::mutex threadsMutex_;
    96             boost::mutex orxonoxEvalMutex_;
     109            boost::try_mutex orxonoxQueueMutex_;
     110            boost::try_mutex threadQueuesMutex_;
     111            boost::try_mutex threadsMutex_;
     112            boost::try_mutex orxonoxStateMutex_;
     113            boost::try_mutex orxonoxQueryMutex_;
    97114
    98115            boost::condition orxonoxQueueCondition_;
     
    100117    };
    101118
    102     _CoreExport void tclThreadLoop(Tcl::interpreter* interpreter, boost::try_mutex* mutex, unsigned int threadID);
     119    _CoreExport void tclThreadLoop(TclThread* tclThread);
    103120}
    104121
Note: See TracChangeset for help on using the changeset viewer.