Changeset 1337 for code/branches
- Timestamp:
- May 20, 2008, 7:08:57 PM (17 years ago)
- Location:
- code/branches/console
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/cmake/FindBoost.cmake
r1230 r1337 116 116 SET(Boost_INCLUDE_DIR 117 117 # ../libs/boost_1_33_1 118 ../libs/boost_1_35_0 118 ../libs/boost_1_34_1 119 # ../libs/boost_1_35_0 119 120 ) 120 121 ELSE(WIN32) … … 192 193 gcc-1_33_1 193 194 gcc-mt-1_33_1 195 mgw34-mt-1_34_1 194 196 mgw34-mt-1_35 195 197 ) -
code/branches/console/src/core/TclThreadManager.cc
r1276 r1337 67 67 this->orxonoxInterpreterBundle_.id_ = 0; 68 68 this->orxonoxInterpreterBundle_.interpreter_ = TclBind::getInstance().getTclInterpreter(); 69 #if (BOOST_VERSION >= 103500) 69 70 this->threadID_ = boost::this_thread::get_id(); 71 #else 72 // 73 #endif 70 74 } 71 75 … … 119 123 { 120 124 boost::mutex::scoped_lock bundles_lock(TclThreadManager::getInstance().bundlesMutex_); 121 boost::mutex::scoped_lock interpreter_lock(bundle->interpreterMutex_, boost::defer_lock_t()); 125 #if (BOOST_VERSION >= 103500) 126 boost::mutex::scoped_try_lock interpreter_lock(bundle->interpreterMutex_); 127 #else 128 boost::try_mutex::scoped_try_lock interpreter_lock(bundle->interpreterMutex_); 129 #endif 122 130 try 123 131 { … … 125 133 { 126 134 TclThreadManager::getInstance().orxonoxEvalCondition_.notify_one(); 135 #if (BOOST_VERSION >= 103500) 127 136 boost::this_thread::yield(); 137 #else 138 boost::thread::yield(); 139 #endif 128 140 } 129 141 } catch (...) {} … … 136 148 137 149 TclThreadManager::getInstance().orxonoxEvalCondition_.notify_one(); 150 #if (BOOST_VERSION >= 103500) 138 151 boost::this_thread::yield(); 152 #else 153 boost::thread::yield(); 154 #endif 139 155 } 140 156 … … 183 199 output += "\t\t"; 184 200 { 185 boost::mutex::scoped_lock interpreter_lock((*it).second->interpreterMutex_, boost::defer_lock_t()); 201 #if (BOOST_VERSION >= 103500) 202 boost::mutex::scoped_try_lock interpreter_lock((*it).second->interpreterMutex_); 203 #else 204 boost::try_mutex::scoped_try_lock interpreter_lock((*it).second->interpreterMutex_); 205 #endif 186 206 if (interpreter_lock.try_lock()) 187 207 output += "ready"; … … 332 352 void TclThreadManager::error(const std::string& error) 333 353 { 354 #if (BOOST_VERSION >= 103500) 334 355 if (boost::this_thread::get_id() != this->threadID_) 356 #else 357 if (boost::thread() != this->threadID_) 358 #endif 335 359 { 336 360 boost::mutex::scoped_lock queue_lock(this->orxonoxInterpreterBundle_.queueMutex_); 337 361 if (this->orxonoxInterpreterBundle_.queue_.size() >= TCLTHREADMANAGER_MAX_QUEUE_LENGTH) 338 362 { 363 #if (BOOST_VERSION >= 103500) 339 364 boost::this_thread::yield(); 365 #else 366 boost::thread::yield(); 367 #endif 340 368 return; 341 369 } … … 347 375 void TclThreadManager::debug(const std::string& error) 348 376 { 377 #if (BOOST_VERSION >= 103500) 349 378 if (boost::this_thread::get_id() != this->threadID_) 379 #else 380 if (boost::thread() != this->threadID_) 381 #endif 350 382 { 351 383 boost::mutex::scoped_lock queue_lock(this->orxonoxInterpreterBundle_.queueMutex_); 352 384 if (this->orxonoxInterpreterBundle_.queue_.size() >= TCLTHREADMANAGER_MAX_QUEUE_LENGTH) 353 385 { 386 #if (BOOST_VERSION >= 103500) 354 387 boost::this_thread::yield(); 388 #else 389 boost::thread::yield(); 390 #endif 355 391 return; 356 392 } … … 461 497 if (this->updateQueriersList(querier, &this->orxonoxInterpreterBundle_)) 462 498 { 499 #if (BOOST_VERSION >= 103500) 463 500 boost::mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_); 501 #else 502 boost::try_mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_); 503 #endif 464 504 this->orxonoxEvalCondition_.wait(interpreter_lock); 465 505 … … 498 538 if (this->updateQueriersList(querier, target)) 499 539 { 500 boost::mutex::scoped_lock interpreter_lock(target->interpreterMutex_, boost::defer_lock_t()); 540 #if (BOOST_VERSION >= 103500) 541 boost::mutex::scoped_try_lock interpreter_lock(target->interpreterMutex_); 542 #else 543 boost::try_mutex::scoped_try_lock interpreter_lock(target->interpreterMutex_); 544 #endif 501 545 bool successfullyLocked = false; 502 546 try … … 507 551 { 508 552 while (!interpreter_lock.try_lock()) 553 { 554 #if (BOOST_VERSION >= 103500) 509 555 boost::this_thread::yield(); 556 #else 557 boost::thread::yield(); 558 #endif 559 } 510 560 511 561 successfullyLocked = true; … … 540 590 { 541 591 this->orxonoxEvalCondition_.notify_one(); 592 #if (BOOST_VERSION >= 103500) 542 593 boost::this_thread::yield(); 594 #else 595 boost::thread::yield(); 596 #endif 543 597 } 544 598 … … 562 616 563 617 { 618 #if (BOOST_VERSION >= 103500) 564 619 boost::mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_); 620 #else 621 boost::try_mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_); 622 #endif 565 623 unsigned long maxtime = (unsigned long)(dt * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE); 566 624 Ogre::Timer timer; … … 577 635 { 578 636 TclThreadManager::getInstance().debug("TclThread_execute: " + command); 637 #if (BOOST_VERSION >= 103500) 579 638 boost::mutex::scoped_lock interpreter_lock(interpreterBundle->interpreterMutex_); 639 #else 640 boost::try_mutex::scoped_lock interpreter_lock(interpreterBundle->interpreterMutex_); 641 #endif 580 642 try 581 643 { -
code/branches/console/src/core/TclThreadManager.h
r1276 r1337 36 36 #include <boost/thread/mutex.hpp> 37 37 #include <boost/thread/condition.hpp> 38 #include <boost/thread/thread.hpp> 38 39 39 40 #include "CorePrereqs.h" … … 119 120 boost::condition fullQueueCondition_; 120 121 boost::condition orxonoxEvalCondition_; 122 #if (BOOST_VERSION >= 103500) 121 123 boost::thread::id threadID_; 124 #else 125 boost::thread threadID_; 126 #endif 122 127 }; 123 128
Note: See TracChangeset
for help on using the changeset viewer.