Eluna fix crash in timed events and prepare some for future changes. Ditched EventProcessor

This commit is contained in:
Rochet2
2014-09-13 16:05:16 +03:00
parent 7be917335a
commit 06be9650bb
12 changed files with 388 additions and 346 deletions

View File

@@ -43,6 +43,9 @@ typedef uint64 ObjectGuid;
#ifndef UNORDERED_MAP
#define UNORDERED_MAP std::unordered_map
#endif
#ifndef UNORDERED_SET
#define UNORDERED_ET std::unordered_set
#endif
class Unit;
class WorldObject;
@@ -91,6 +94,35 @@ namespace ElunaUtil
WorldObjectInRangeCheck(WorldObjectInRangeCheck const&);
};
/*
* Usage:
* Inherit this class, then when needing lock, use
* ReadGuard lock(_lock);
* or
* WriteGuard lock(_lock);
*
* The lock is automatically released at end of scope
*/
class RWLockable
{
public:
#ifdef USING_BOOST
typedef boost::shared_mutex LockType;
typedef boost::shared_lock<boost::shared_mutex> ReadGuard;
typedef boost::unique_lock<boost::shared_mutex> WriteGuard;
#else
typedef ACE_RW_Thread_Mutex LockType;
typedef ACE_Read_Guard<LockType> ReadGuard;
typedef ACE_Write_Guard<LockType> WriteGuard;
#endif
LockType& GetLock() { return _lock; }
private:
LockType _lock;
};
};
#endif