Skip to content

Commit

Permalink
improve Win32 dispatchMainThreadEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
irov committed Jan 7, 2024
1 parent 16eff96 commit 7ff5bee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Platforms/Win32Platform/Win32PlatformService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Interface/ProfilerSystemInterface.h"
#include "Interface/DateTimeSystemInterface.h"
#include "Interface/ThreadSystemInterface.h"
#include "Interface/ThreadServiceInterface.h"
#include "Interface/PluginInterface.h"
#include "Interface/ServiceInterface.h"

Expand Down Expand Up @@ -839,6 +840,16 @@ namespace Mengine
//////////////////////////////////////////////////////////////////////////
void Win32PlatformService::dispatchMainThreadEvent( const LambdaEvent & _event )
{
bool isMainThread = THREAD_SERVICE()
->isMainThread();

if( isMainThread == true )
{
_event();

return;
}

m_dispatchEventMutex->lock();

m_dispatchEvents.emplace_back( _event );
Expand Down

0 comments on commit 7ff5bee

Please sign in to comment.