From 9fc5c4bc41b2738836ce99eb42ddbb88fb398884 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 22 Feb 2016 20:02:26 +0100 Subject: Core/PacketIO: Requeue packets handled with STATUS_LOGGEDIN received before player is fully loaded in one step after packet processing loop - reduces used locks from 3 per packet to 1 per packet (cherry picked from commit 8086a39210659c44d52fb463f5a39f047aa45685) --- src/common/Threading/LockedQueue.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/common/Threading/LockedQueue.h') diff --git a/src/common/Threading/LockedQueue.h b/src/common/Threading/LockedQueue.h index c6faaaf81ca..21a29d7e53b 100644 --- a/src/common/Threading/LockedQueue.h +++ b/src/common/Threading/LockedQueue.h @@ -57,6 +57,14 @@ public: unlock(); } + //! Adds items back to front of the queue + template + void readd(Iterator begin, Iterator end) + { + std::lock_guard lock(_lock); + _queue.insert(_queue.begin(), begin, end); + } + //! Gets the next result in the queue, if any. bool next(T& result) { -- cgit v1.2.3