From Xin Li, "use std::list::splice to replace std::list::insert and std::list::clear

it may use the constant time to move all the items in the '_eventQueue' to 'events', and reduce the mutex holding time"
This commit is contained in:
Robert Osfield
2010-05-31 15:52:25 +00:00
parent 7c4f2b7d1f
commit df57965a34

View File

@@ -53,8 +53,7 @@ bool EventQueue::takeEvents(Events& events)
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
if (!_eventQueue.empty())
{
events.insert(events.end(),_eventQueue.begin(),_eventQueue.end());
_eventQueue.clear();
events.splice(events.end(), _eventQueue);
return true;
}
else