diff options
Diffstat (limited to 'src/server/shared/Threading/LockedQueue.h')
-rwxr-xr-x | src/server/shared/Threading/LockedQueue.h | 7 |
1 files changed, 5 insertions, 2 deletions
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; } |