Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 15, 2008, 1:05:58 AM (16 years ago)
Author:
landauf
Message:

someone likes to chat? well, I do. here's a new IRC client. it connects directly into our irc.datacore.ch / #orxonox channel with a random nickname. use the "say text" command to write text into the channel. there are some more commands without a shortcut, type "IRC" and tab.
please update your media directory.

for some reason, irc-client and telnet-remote don't work together. please use only one feature at the same time. I'm not sure if it's a bug in TCL or in my TclThreadManager class. The problem also occurs with irc or telnet in parallel with another busy tcl-thread… strange thing.

File:
1 edited

Legend:

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

    r1269 r1276  
    5858    ConsoleCommand(TclThreadManager, flush,     AccessLevel::None, false);
    5959
    60     TclThreadManager* instance = &TclThreadManager::getInstance();
     60    TclThreadManager* instance_tclthreadmanager = &TclThreadManager::getInstance();
    6161
    6262    TclThreadManager::TclThreadManager()
     
    9292        COUT(0) << "Created new Tcl-interpreter with ID " << TclThreadManager::getInstance().threadCounter_ << std::endl;
    9393        return TclThreadManager::getInstance().threadCounter_;
     94    }
     95
     96    unsigned int TclThreadManager::createID(unsigned int threadID)
     97    {
     98        unsigned int temp = TclThreadManager::getInstance().threadCounter_;
     99        TclThreadManager::getInstance().threadCounter_ = threadID - 1;
     100        TclThreadManager::create();
     101        TclThreadManager::getInstance().threadCounter_ = temp;
     102        return threadID;
    94103    }
    95104
     
    136145    void TclThreadManager::execute(unsigned int threadID, const std::string& _command)
    137146    {
    138         std::string command = _command;
    139         while (command.size() >= 2 && command[0] == '{' && command[command.size() - 1] == '}')
    140             command = command.substr(1, command.size() - 2);
    141 
     147        std::string command = stripEnclosingBraces(_command);
    142148
    143149        if (threadID == 0)
     
    237243    void TclThreadManager::tcl_execute(Tcl::object const &args)
    238244    {
    239         std::string command = args.get();
    240         while (command.size() >= 2 && command[0] == '{' && command[command.size() - 1] == '}')
    241             command = command.substr(1, command.size() - 2);
    242 
    243         TclThreadManager::getInstance().pushCommandToQueue(command);
     245        TclThreadManager::getInstance().pushCommandToQueue(stripEnclosingBraces(args.get()));
    244246    }
    245247
    246248    std::string TclThreadManager::tcl_query(int querierID, Tcl::object const &args)
    247249    {
    248         std::string command = args.get();
    249         while (command.size() >= 2 && command[0] == '{' && command[command.size() - 1] == '}')
    250             command = command.substr(1, command.size() - 2);
    251 
    252         return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, command);
     250        return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, stripEnclosingBraces(args.get()));
    253251    }
    254252
    255253    std::string TclThreadManager::tcl_crossquery(int querierID, int threadID, Tcl::object const &args)
    256254    {
    257         std::string command = args.get();
    258         while (command.size() >= 2 && command[0] == '{' && command[command.size() - 1] == '}')
    259             command = command.substr(1, command.size() - 2);
    260 
    261         return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, (unsigned int)threadID, command);
     255        return TclThreadManager::getInstance().evalQuery((unsigned int)querierID, (unsigned int)threadID, stripEnclosingBraces(args.get()));
    262256    }
    263257
     
    349343
    350344        this->forceCommandToFrontOfQueue("error " + error);
     345    }
     346
     347    void TclThreadManager::debug(const std::string& error)
     348    {
     349        if (boost::this_thread::get_id() != this->threadID_)
     350        {
     351            boost::mutex::scoped_lock queue_lock(this->orxonoxInterpreterBundle_.queueMutex_);
     352            if (this->orxonoxInterpreterBundle_.queue_.size() >= TCLTHREADMANAGER_MAX_QUEUE_LENGTH)
     353            {
     354                boost::this_thread::yield();
     355                return;
     356            }
     357        }
     358
     359        this->forceCommandToFrontOfQueue("debug " + error);
    351360    }
    352361
     
    506515                    if (successfullyLocked)
    507516                    {
     517                        this->debug("TclThread_query: " + command);
    508518                        try
    509519                        {   output = (std::string)target->interpreter_->eval(command);   }
     
    566576    void tclThread(TclInterpreterBundle* interpreterBundle, std::string command)
    567577    {
    568 std::cout << "tclthreadm executes " << command << std::endl;
     578        TclThreadManager::getInstance().debug("TclThread_execute: " + command);
    569579        boost::mutex::scoped_lock interpreter_lock(interpreterBundle->interpreterMutex_);
    570580        try
Note: See TracChangeset for help on using the changeset viewer.