Files
mandy/third_party/xtaskqueue/Source/Task/ThreadPool.h
IAmNotSiob 36bc1200ad Runtime: offline xgameruntime shim (XGameRuntime, XSystem, XTaskQueue, XAsync)
Every GDK title calls XGameRuntimeInitialize first and builds its async work on
XTaskQueue/XAsync. Add an xgameruntime.dll shim table for those, ahead of the
executable: XGameRuntimeInitialize/Uninitialize (reference counted),
XSystemGetDeviceType (Series X; LEONIDA_DEVICE_TYPE overrides) and
XSystemGetConsoleId (placeholder), plus the 23 XTaskQueue/XAsync functions.

XTaskQueue/XAsync come from microsoft/libHttpClient (MIT), copied unmodified
into third_party/xtaskqueue (task queue only, no HTTP stack); a small pch.h
stand-in lets them build alone. xgameruntime_test drives the table through
the shim registry the way a title boots. Nothing goes online.
2026-11-21 23:06:10 +01:00

38 lines
1.0 KiB
C++

#pragma once
namespace OS
{
struct ThreadPoolActionStatus
{
virtual void Complete() = 0;
virtual void MayRunLong() = 0;
};
using ThreadPoolCallback = void(_In_opt_ void*, _In_ ThreadPoolActionStatus& status);
class ThreadPoolImpl;
// A thread pool will invoke its callback on a pool of threads.
class ThreadPool
{
public:
ThreadPool() noexcept;
~ThreadPool() noexcept;
// Initializes the thread pool.
HRESULT Initialize(_In_opt_ void* context, _In_ ThreadPoolCallback* callback) noexcept;
// Terminates the thread pool, waiting for any outstanding calls to drain
// and and canceling any pending calls.
void Terminate() noexcept;
// Submits a new callback to the thread pool. The callback passed to Initialize will
// be invoked on a thread pool thread. May throw / crash if called after termination
// or before init.
void Submit();
private:
ThreadPoolImpl* m_impl;
};
}