mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Try fix data race for people trying to mthread
This commit is contained in:
@@ -16,6 +16,7 @@ extern "C"
|
|||||||
|
|
||||||
ElunaEventProcessor::ElunaEventProcessor(Eluna** _E, WorldObject* _obj) : m_time(0), obj(_obj), E(_E)
|
ElunaEventProcessor::ElunaEventProcessor(Eluna** _E, WorldObject* _obj) : m_time(0), obj(_obj), E(_E)
|
||||||
{
|
{
|
||||||
|
// can be called from multiple threads
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
EventMgr::Guard guard((*E)->eventMgr->GetLock());
|
EventMgr::Guard guard((*E)->eventMgr->GetLock());
|
||||||
@@ -25,7 +26,11 @@ ElunaEventProcessor::ElunaEventProcessor(Eluna** _E, WorldObject* _obj) : m_time
|
|||||||
|
|
||||||
ElunaEventProcessor::~ElunaEventProcessor()
|
ElunaEventProcessor::~ElunaEventProcessor()
|
||||||
{
|
{
|
||||||
RemoveEvents_internal();
|
// can be called from multiple threads
|
||||||
|
{
|
||||||
|
LOCK_ELUNA;
|
||||||
|
RemoveEvents_internal();
|
||||||
|
}
|
||||||
|
|
||||||
if (obj && Eluna::IsInitialized())
|
if (obj && Eluna::IsInitialized())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user