Files
UnrealEngineUWP/Engine/Source/Runtime/Messaging/Private/Bus/MessageBus.cpp
Jaroslaw Palczynski 724ea452a5 Refactoring thread affinity settings.
There was a bug in setting affinity of a thread that assumed affinity from lookup table with key being a thread name. When names was appended with consecutive numbers (e.g. "RenderingThread 1") the mechanism failed. Refactored this to use special static consts describing affinity override'able by different platforms for different affinity types + possibility of setting affinity per thread.
#codereview Jaroslaw.Surowiec

[CL 2070197 by Jaroslaw Palczynski in Main branch]
2014-05-12 08:40:54 -04:00

45 lines
1.1 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
MessageBus.cpp: Implements the FMessageBus class.
=============================================================================*/
#include "MessagingPrivatePCH.h"
/* FMessageBus structors
*****************************************************************************/
FMessageBus::FMessageBus( const IAuthorizeMessageRecipientsPtr& InRecipientAuthorizer )
: RecipientAuthorizer(InRecipientAuthorizer)
{
Router = new FMessageRouter();
RouterThread = FRunnableThread::Create(Router, TEXT("FMessageBus.Router"), 128 * 1024, TPri_Normal, FPlatformAffinity::GetPoolThreadMask());
check(Router != nullptr);
}
FMessageBus::~FMessageBus( )
{
Shutdown();
delete Router;
}
/* IMessageBus interface
*****************************************************************************/
void FMessageBus::Shutdown( )
{
if (RouterThread != nullptr)
{
ShutdownDelegate.Broadcast();
RouterThread->Kill(true);
delete RouterThread;
RouterThread = nullptr;
}
}