You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Added so session information contains information about number of processor groups * Added so detoured process matches uba message thread's processor group [CL 31607498 by henrik karlsson in ue5-main branch]
45 lines
817 B
C++
45 lines
817 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "UbaEvent.h"
|
|
#include "UbaMemory.h"
|
|
|
|
namespace uba
|
|
{
|
|
class Event;
|
|
struct GroupAffinity;
|
|
|
|
|
|
class Thread
|
|
{
|
|
public:
|
|
Thread();
|
|
Thread(Function<u32()>&& func);
|
|
~Thread();
|
|
void Start(Function<u32()>&& func);
|
|
bool Wait(u32 milliseconds = ~0u, Event* wakeupEvent = nullptr);
|
|
bool GetGroupAffinity(GroupAffinity& out);
|
|
|
|
private:
|
|
Function<u32()> m_func;
|
|
void* m_handle = nullptr;
|
|
|
|
#if !PLATFORM_WINDOWS
|
|
Event m_finished;
|
|
#endif
|
|
|
|
Thread(const Thread&) = delete;
|
|
void operator=(const Thread&) = delete;
|
|
};
|
|
|
|
|
|
struct GroupAffinity
|
|
{
|
|
u64 mask = 0;
|
|
u16 group = 0;
|
|
};
|
|
bool SetThreadGroupAffinity(void* nativeThreadHandle, const GroupAffinity& affinity);
|
|
bool AlternateThreadGroupAffinity(void* nativeThreadHandle);
|
|
}
|