From ed0319cfed2c99e6366aaf725d96bb28a9332e4d Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 2 Jul 2022 12:33:49 -0400 Subject: common/fiber: make fibers easier to use --- src/core/cpu_manager.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/core/cpu_manager.h') diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h index f0751fc58..76dc58ee1 100644 --- a/src/core/cpu_manager.h +++ b/src/core/cpu_manager.h @@ -50,10 +50,15 @@ public: void Initialize(); void Shutdown(); - static std::function GetGuestThreadStartFunc(); - static std::function GetIdleThreadStartFunc(); - static std::function GetShutdownThreadStartFunc(); - void* GetStartFuncParameter(); + std::function GetGuestThreadStartFunc() { + return [this] { GuestThreadFunction(); }; + } + std::function GetIdleThreadStartFunc() { + return [this] { IdleThreadFunction(); }; + } + std::function GetShutdownThreadStartFunc() { + return [this] { ShutdownThreadFunction(); }; + } void PreemptSingleCore(bool from_running_enviroment = true); @@ -62,10 +67,10 @@ public: } private: - static void GuestThreadFunction(void* cpu_manager); - static void GuestRewindFunction(void* cpu_manager); - static void IdleThreadFunction(void* cpu_manager); - static void ShutdownThreadFunction(void* cpu_manager); + void GuestThreadFunction(); + void GuestRewindFunction(); + void IdleThreadFunction(); + void ShutdownThreadFunction(); void MultiCoreRunGuestThread(); void MultiCoreRunGuestLoop(); -- cgit v1.2.3