26 lines
549 B
C++
26 lines
549 B
C++
// Copyright UnexGames 2025. All Rights Reserved.
|
|
#include "ThreadPool.h"
|
|
|
|
bool UThreadPool::Create(uint32 InNumQueuedThreads, const FString Name, EThreadPriority ThreadPriority, uint32 StackSize)
|
|
{
|
|
Obj = MakeShareable<FQueuedThreadPool>(FQueuedThreadPool::Allocate());
|
|
const bool bResult = Obj->Create(InNumQueuedThreads, StackSize, ThreadPriority, *Name);
|
|
if (bResult)
|
|
{
|
|
return true;
|
|
}
|
|
else {
|
|
Obj = nullptr;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
int32 UThreadPool::GetThreadsNum()
|
|
{
|
|
if (Obj.IsValid())
|
|
{
|
|
return Obj->GetNumThreads();
|
|
}
|
|
return 0;
|
|
}
|