From 8e0be985fdc841357606c07fd2992f767f1f00f4 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Mon, 19 Dec 2011 21:12:35 +0100 Subject: Core/Netcode: Fix a possible infinite loop after 829be0b82 (which was accidentally merged in this morning) --- src/server/shared/Threading/LockedQueue.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/server/shared/Threading/LockedQueue.h') diff --git a/src/server/shared/Threading/LockedQueue.h b/src/server/shared/Threading/LockedQueue.h index 92eab440684..4d2ddd33f5f 100755 --- a/src/server/shared/Threading/LockedQueue.h +++ b/src/server/shared/Threading/LockedQueue.h @@ -98,13 +98,16 @@ namespace ACE_Based return true; } - //! Peeks at the top of the queue. Remember to unlock after use. - T& peek() + //! Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false. + T& peek(bool autoUnlock = false) { lock(); T& result = _queue.front(); + if (autoUnlock) + unlock(); + return result; } -- cgit v1.2.3