Files
FEX-Emu--FEX/Source/Tools/FEXLoader/LinuxSyscalls/Utils/Threads.h
T
Ryan Houdek 75a62f856b Threads: Moves pthread logic to FEXLoader
This is not an attempt to clean up the various issues with the pthread
logic, instead just moving the pthread specific logic out of FEXCore in
to FEXLoader.

FEXCore needs to know how to create threads in an agnostic way. Which is
why we obfuscate the details with this inteface.

Initially this was implemented with the pthread handlers in FEXCore and
expected eventually for those to get moved to the frontend. This is the
time when it has been moved.

This is the first step towards compiling with llvm-mingw.

Still a long way to go.
2023-04-15 15:24:30 -07:00

35 lines
856 B
C++

#pragma once
#include <cstddef>
namespace FEX::LinuxEmulation::Threads {
/**
* @brief Size of the stack that this interface creates.
*/
constexpr size_t STACK_SIZE = 8 * 1024 * 1024;
/**
* @brief Allocates a stack object from the internally managed stack pool.
*/
void *AllocateStackObject();
/**
* @brief Deallocates a stack from the internally managed stack pool.
*
* Will not free the memory immediately, instead saving for reuse temporarily to solve race conditions on stack usage while stack tears down.
*
* @param Ptr The stack base from `AllocateStackObject`
*/
void DeallocateStackObject(void *Ptr);
/**
* @brief Registers thread creation handlers with FEXCore.
*/
void SetupThreadHandlers();
/**
* @brief Cleans up any remaining stack objects in the pools.
*/
void Shutdown();
}