mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 02:29:59 -06:00
Core: Remove RunAsCPUThread
It's a fine function, but CPUThreadGuard is more vogue. Also, its potential for being confused with RunOnCPUThread will not be missed.
This commit is contained in:
@ -788,14 +788,14 @@ static std::string GenerateScreenshotName()
|
||||
|
||||
void SaveScreenShot()
|
||||
{
|
||||
Core::RunAsCPUThread([] { g_frame_dumper->SaveScreenshot(GenerateScreenshotName()); });
|
||||
const Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
g_frame_dumper->SaveScreenshot(GenerateScreenshotName());
|
||||
}
|
||||
|
||||
void SaveScreenShot(std::string_view name)
|
||||
{
|
||||
Core::RunAsCPUThread([&name] {
|
||||
g_frame_dumper->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name));
|
||||
});
|
||||
const Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
g_frame_dumper->SaveScreenshot(fmt::format("{}{}.png", GenerateScreenshotFolderPath(), name));
|
||||
}
|
||||
|
||||
static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unlock)
|
||||
@ -837,20 +837,6 @@ static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unl
|
||||
return was_unpaused;
|
||||
}
|
||||
|
||||
void RunAsCPUThread(std::function<void()> function)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
const bool is_cpu_thread = IsCPUThread();
|
||||
bool was_unpaused = false;
|
||||
if (!is_cpu_thread)
|
||||
was_unpaused = PauseAndLock(system, true, true);
|
||||
|
||||
function();
|
||||
|
||||
if (!is_cpu_thread)
|
||||
PauseAndLock(system, false, was_unpaused);
|
||||
}
|
||||
|
||||
void RunOnCPUThread(std::function<void()> function, bool wait_for_completion)
|
||||
{
|
||||
// If the CPU thread is not running, assume there is no active CPU thread we can race against.
|
||||
|
Reference in New Issue
Block a user