mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -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:
@ -112,9 +112,9 @@ static void RunWithGPUThreadInactive(std::function<void()> f)
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we reach here, we can call Core::PauseAndLock (which we do using RunAsCPUThread).
|
||||
|
||||
Core::RunAsCPUThread(std::move(f));
|
||||
// If we reach here, we can call Core::PauseAndLock (which we do using a CPUThreadGuard).
|
||||
const Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ static bool QtMsgAlertHandler(const char* caption, const char* text, bool yes_no
|
||||
std::optional<bool> r = RunOnObject(QApplication::instance(), [&] {
|
||||
// If we were called from the CPU/GPU thread, set us as the CPU/GPU thread.
|
||||
// This information is used in order to avoid deadlocks when calling e.g.
|
||||
// Host::SetRenderFocus or Core::RunAsCPUThread. (Host::SetRenderFocus
|
||||
// Host::SetRenderFocus or Core::CPUThreadGuard. (Host::SetRenderFocus
|
||||
// can get called automatically when a dialog steals the focus.)
|
||||
|
||||
Common::ScopeGuard cpu_scope_guard(&Core::UndeclareAsCPUThread);
|
||||
|
@ -1932,12 +1932,13 @@ void MainWindow::OnStopRecording()
|
||||
|
||||
void MainWindow::OnExportRecording()
|
||||
{
|
||||
Core::RunAsCPUThread([this] {
|
||||
QString dtm_file = DolphinFileDialog::getSaveFileName(
|
||||
this, tr("Save Recording File As"), QString(), tr("Dolphin TAS Movies (*.dtm)"));
|
||||
if (!dtm_file.isEmpty())
|
||||
Core::System::GetInstance().GetMovie().SaveRecording(dtm_file.toStdString());
|
||||
});
|
||||
auto& system = Core::System::GetInstance();
|
||||
const Core::CPUThreadGuard guard(system);
|
||||
|
||||
QString dtm_file = DolphinFileDialog::getSaveFileName(
|
||||
this, tr("Save Recording File As"), QString(), tr("Dolphin TAS Movies (*.dtm)"));
|
||||
if (!dtm_file.isEmpty())
|
||||
system.GetMovie().SaveRecording(dtm_file.toStdString());
|
||||
}
|
||||
|
||||
void MainWindow::OnActivateChat()
|
||||
@ -1990,13 +1991,12 @@ void MainWindow::ShowTASInput()
|
||||
|
||||
void MainWindow::OnConnectWiiRemote(int id)
|
||||
{
|
||||
Core::RunAsCPUThread([&] {
|
||||
if (const auto bt = WiiUtils::GetBluetoothEmuDevice())
|
||||
{
|
||||
const auto wm = bt->AccessWiimoteByIndex(id);
|
||||
wm->Activate(!wm->IsConnected());
|
||||
}
|
||||
});
|
||||
const Core::CPUThreadGuard guard(Core::System::GetInstance());
|
||||
if (const auto bt = WiiUtils::GetBluetoothEmuDevice())
|
||||
{
|
||||
const auto wm = bt->AccessWiimoteByIndex(id);
|
||||
wm->Activate(!wm->IsConnected());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
|
Reference in New Issue
Block a user