From df57965a3402edf4ac3fc58706440b3e3deb239d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 31 May 2010 15:52:25 +0000 Subject: [PATCH] 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" --- src/osgGA/EventQueue.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/osgGA/EventQueue.cpp b/src/osgGA/EventQueue.cpp index f8db4ab1e..16b195308 100644 --- a/src/osgGA/EventQueue.cpp +++ b/src/osgGA/EventQueue.cpp @@ -53,8 +53,7 @@ bool EventQueue::takeEvents(Events& events) OpenThreads::ScopedLock lock(_eventQueueMutex); if (!_eventQueue.empty()) { - events.insert(events.end(),_eventQueue.begin(),_eventQueue.end()); - _eventQueue.clear(); + events.splice(events.end(), _eventQueue); return true; } else