Changeset 12765 for source/ariba/utility
- Timestamp:
- Mar 14, 2014, 8:26:33 PM (11 years ago)
- Location:
- source/ariba/utility/system
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/system/SystemQueue.cpp
r12764 r12765 76 76 void SystemQueue::scheduleEvent( const SystemEvent& event, uint32_t delay ) 77 77 { 78 assert ( SysQ->running ); // should we really enforce this? 78 // assert ( SysQ->running ); // should we really enforce this? 79 if ( ! SysQ->running ) 80 { 81 logging_debug("/// WARNING: The SystemQueue is NOT RUNNING!"); 82 } 79 83 80 84 // copy … … 140 144 SysQ.reset( new QueueThread() ); 141 145 } 146 147 148 void SystemQueue::leave() 149 { 150 // signal SysQ to quit (and abort queued events) 151 SysQ->cancel(); 152 } 153 154 void SystemQueue::join() 155 { 156 if ( sysq_thread ) 157 { 158 logging_debug("/// ... joining SysQ thread"); 159 sysq_thread->join(); 160 } 161 } 162 163 142 164 143 165 void SystemQueue::dropAll( const SystemEventListener* mlistener) … … 303 325 if ( timedEventsQ.empty() ) 304 326 { 305 logging_debug("/// SysQ is going to sleep.");327 // logging_debug("/// SysQ is going to sleep."); 306 328 307 329 this->system_queue_idle.wait( lock ); … … 310 332 else 311 333 { 312 logging_debug( "/// SysQ is going to sleep for "313 << ( timedEventsQ.top().deadline - get_clock() ).total_milliseconds()314 << "ms. Deadline: "315 << timedEventsQ.top().deadline316 << ", Clock: "317 << get_clock() );334 // logging_debug( "/// SysQ is going to sleep for " 335 // << ( timedEventsQ.top().deadline - get_clock() ).total_milliseconds() 336 // << "ms. Deadline: " 337 // << timedEventsQ.top().deadline 338 // << ", Clock: " 339 // << get_clock() ); 318 340 319 341 this->system_queue_idle.timed_wait( lock, timedEventsQ.top().deadline ); -
source/ariba/utility/system/SystemQueue.h
r12764 r12765 117 117 * Cancels the system queue and ends the processing after the 118 118 * currently processed event is processed. 119 * 120 * NOTE: Do not call this function from within a SystemQueue-Event. 121 * Use SystemQueue::leave() instead. 119 122 * 120 123 * This method is thread-safe. 121 124 */ 122 125 void cancel(); 126 127 /** 128 * Like SystemQueue::cancel(), but may only be called from within a SystemQueue-Event. 129 * 130 * NOTE: In this case some cleanup can not be made. -- If the SystemQueue is 131 * restarted, SystemQueue::cancel() must be called before SystemQueue::run() 132 * can be called again. 133 */ 134 void leave(); 135 136 /** 137 * Join the SystemQueue thread -- the current thread is blocked until the 138 * SystemQueue finishes. 139 * 140 * NOTE: Use this only in combination with SystemQueue::leave() 141 * 142 * [ There is a possible race condition with SystemQueue::cancel(), but 143 * SystemQueue::join() should not be used at the same time as 144 * SystemQueue::cancel() anyway. (SystemQueue::leave() is fine, though.) 145 */ 146 void join(); 123 147 124 148 /**
Note:
See TracChangeset
for help on using the changeset viewer.