Files
FEX-Emu--FEX/FEXCore/include/FEXCore/Utils/Threads.h
T
Ryan Houdek a8bee07d8f FEXCore: Move two functions to the frontend
Only used in the frontend and is OS specific.
2026-01-26 20:11:36 -08:00

41 lines
876 B
C++

// SPDX-License-Identifier: MIT
#pragma once
#include <FEXCore/fextl/memory.h>
namespace FEXCore::Threads {
using ThreadFunc = void* (*)(void* user_ptr);
class Thread;
using CreateThreadFunc = fextl::unique_ptr<Thread> (*)(ThreadFunc Func, void* Arg);
using CleanupAfterForkFunc = void (*)();
struct Pointers {
CreateThreadFunc CreateThread;
CleanupAfterForkFunc CleanupAfterFork;
};
// API
class Thread {
public:
virtual ~Thread() = default;
virtual bool joinable() = 0;
virtual bool join(void** ret) = 0;
virtual bool detach() = 0;
virtual bool IsSelf() = 0;
/**
* @name Calls provided API functions
* @{ */
static fextl::unique_ptr<Thread> Create(ThreadFunc Func, void* Arg);
static void CleanupAfterFork();
/** @} */
// Set API functions
static void SetInternalPointers(const Pointers& _Ptrs);
};
} // namespace FEXCore::Threads