Hello
I wonder if the Multithread functions can be checked through Unreal Insight.
I am testing some heavy codes through AsyncTask and FRunnable.
And I want to see how they are executing at Unreal insight.
void WorkHard()
{
FSocket* Socket = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateSocket(TEXT("Stream"), TEXT("Client Socket"));
FString address = TEXT("127.0.0.1");
FIPv4Address ip;
FIPv4Address::Parse(address, ip);
int32 port = 6000;
TSharedRef<FInternetAddr> addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
addr->SetIp(ip.Value);
addr->SetPort(port);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Trying to connect@@@@@.")));
bool isConnetcted = Socket->Connect(*addr);
}
This is a just simple code that is trying to connect to other socket and the Connect function takes quite long time.
When I exeucute this function with AsyncTask, I can find which thread executes this function as well.
void WorkHardAsync()
{
AsyncTask(ENamedThreads::AnyNormalThreadNormalTask, [this]()
{
WorkHard();
}
);
}
Foreground Thread executed this function for 2s and when i scroll down, I could find other background Thread executed this function for 2s.
However when I execute this through FRunnable, I couldn’t find where this function is executed.
uint32 FMyRunnable::Run()
{
while (!bShutdown)
{
UE_LOG(LogTemp, Warning, TEXT("My custom thread is running!"))
FPlatformProcess::Sleep(2.0f);
FSocket* Socket = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateSocket(TEXT("Stream"), TEXT("Client Socket"));
FString address = TEXT("127.0.0.1");
FIPv4Address ip;
FIPv4Address::Parse(address, ip);
int32 port = 6000;
TSharedRef<FInternetAddr> addr = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->CreateInternetAddr();
addr->SetIp(ip.Value);
addr->SetPort(port);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("Trying to connect@@@@@.")));
bool isConnetcted = Socket->Connect(*addr);
}
return 0;
}
It seems the function is exeucuted properly because I tried another code that count a number in this FRunnable’s Run() function.
I expected that there is an execution that takes long time in anythread or new thread but I can’t find when I use FRunnable. Where can I confirm it through Unreal Insight?