Changeset 12771
- Timestamp:
- Mar 19, 2014, 6:41:45 PM (11 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/system/SystemQueue.cpp
r12767 r12771 117 117 { 118 118 // CHECK: this function must not be called from within a SystemQueue-Event 119 if ( sysq_thread && boost::this_thread::get_id() == sysq_thread->get_id() ) 119 if ( am_I_in_the_SysQ_thread() ) 120 // if ( sysq_thread && boost::this_thread::get_id() == sysq_thread->get_id() ) 120 121 { 121 122 logging_warn("SystemQueue::cancel() was called from within a SystemQueue-Event. This is not allowed!"); … … 179 180 { 180 181 return SysQ->isRunning(); 182 } 183 184 bool SystemQueue::am_I_in_the_SysQ_thread() 185 { 186 return sysq_thread && boost::this_thread::get_id() == sysq_thread->get_id(); 181 187 } 182 188 -
source/ariba/utility/system/SystemQueue.h
r12765 r12771 161 161 * Is the system queue already started and running? 162 162 * 163 * @return T rue, if the system queue is running.163 * @return TRUE, if the system queue is running. | FALSE otherwise 164 164 */ 165 165 bool isRunning(); 166 167 /** 168 * NOTE: This function is for debugging and asserts only!! 169 * 170 * @return TRUE if called from the SysQ thread (from inside a SystemEvent) 171 * | FALSE if it's called from another thread 172 */ 173 bool am_I_in_the_SysQ_thread(); 166 174 167 175 protected: -
tests/SystemQueue-tests.cc
r12765 r12771 94 94 cout << "### Check ### "<< endl; 95 95 96 checkmark = true; 97 } 98 99 void CheckThread() 100 { 101 EXPECT_TRUE( SystemQueue::instance().am_I_in_the_SysQ_thread() ); 102 96 103 checkmark = true; 97 104 } … … 345 352 } 346 353 354 355 TEST_F(SystemQueueTest, ThreadDetection) 356 { 357 SystemQueue& sysq = SystemQueue::instance(); 358 359 // start 360 sysq.run(); 361 362 EXPECT_FALSE( sysq.am_I_in_the_SysQ_thread() ); 363 364 // scheduleCall 365 sysq.scheduleCall( 366 boost::bind(&SystemQueueTest::CheckThread, this) 367 ); 368 369 wait_for_checkmark(MAX_WAIT); 370 371 sysq.cancel(); 372 373 EXPECT_TRUE( checkmark ) << "WARNING! One of the test functions was not called at all!"; 374 } 375 376 347 377 /** 348 378 * schedule multiple calls
Note:
See TracChangeset
for help on using the changeset viewer.