diff options
author | click <none@none> | 2010-12-13 22:37:56 +0100 |
---|---|---|
committer | click <none@none> | 2010-12-13 22:37:56 +0100 |
commit | 26428943423d14e8672682ab1f19925b76c2aa35 (patch) | |
tree | 1c6d80c03cbf566879e5c899533a2dea5a73dd4c /src/server/shared/Threading/LockedQueue.h | |
parent | 89a33bbf612fcd0d5cea8e1fc5deff87e53aa67e (diff) |
Core: Add new system for parallelizing client packet processing. Handle WorldSession updates in Map::Update() where we are safe to proceed. Patch by Ambal.
(And clean up tabs and whitespace while rummaging around in there)
Closes issue 5084.
--HG--
branch : trunk
Diffstat (limited to 'src/server/shared/Threading/LockedQueue.h')
-rwxr-xr-x | src/server/shared/Threading/LockedQueue.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/server/shared/Threading/LockedQueue.h b/src/server/shared/Threading/LockedQueue.h index 63927ccb2e9..ff03f0c7c10 100755 --- a/src/server/shared/Threading/LockedQueue.h +++ b/src/server/shared/Threading/LockedQueue.h @@ -82,6 +82,22 @@ namespace ACE_Based return true; } + template<class Checker> + bool next(T& result, Checker& check) + { + ACE_Guard<LockType> g(this->_lock); + + if (_queue.empty()) + return false; + + result = _queue.front(); + if(!check.Process(result)) + return false; + + _queue.pop_front(); + return true; + } + //! Peeks at the top of the queue. Remember to unlock after use. T& peek() { |