Changeset 4712 for source


Ignore:
Timestamp:
Jul 3, 2009, 10:34:24 AM (15 years ago)
Author:
Christoph Mayer
Message:

system queue fixing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/system/SystemQueue.cpp

    r4704 r4712  
    141141        // cause the thread to exit
    142142        {
     143                // get the lock, when we got the lock the
     144                // queue thread must be in itemsAvailable.wait()
    143145                boost::mutex::scoped_lock lock(queueMutex);
     146               
     147                // set the running indicator and signal to run on
     148                // this will run the thread and quit it
    144149                running = false;
    145 
    146                 while( eventsQueue.size() > 0 ){
    147                         eventsQueue.erase( eventsQueue.begin() );
    148                 }
    149 
    150150                itemsAvailable.notify_all();
    151151        }
    152152
    153         // wait that the thread has exited
    154         // and delete it, so that a subsuquent run() can be called
    155 
     153        // wait until the thread has exited
    156154        queueThread->join();
     155
     156        // delete pending events
     157        while( eventsQueue.size() > 0 ){
     158                eventsQueue.erase( eventsQueue.begin() );
     159        }
     160
     161        // delete the thread, so that a subsuquent run() can be called
    157162        delete queueThread;
    158163        queueThread = NULL;
     
    193198                // this and cause the thread to exit
    194199
    195                 while ( obj->eventsQueue.empty() && obj->running ){
     200                while ( obj->running && obj->eventsQueue.empty() ){
    196201
    197202//                      const boost::system_time duration =
    198203//                                      boost::get_system_time() +
    199204//                                      boost::posix_time::milliseconds(100);
     205//                      obj->itemsAvailable.timed_wait( lock, duration );
    200206
    201207                        obj->itemsAvailable.wait( lock );
    202 //                      obj->itemsAvailable.timed_wait( lock, duration );
    203208                }
    204209
     
    207212                //
    208213
    209                 while( !obj->eventsQueue.empty() && obj->running ) {
     214                while( obj->running && (!obj->eventsQueue.empty()) ) {
    210215
    211216                        // fetch the first item in the queue
Note: See TracChangeset for help on using the changeset viewer.