Skip to content

Commit e44aff0

Browse files
committed
Host: Add RunOnGSThread helper
1 parent 80d67d5 commit e44aff0

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

pcsx2-qt/QtHost.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,11 @@ void Host::RunOnCPUThread(std::function<void()> function, bool block /* = false
12131213
Q_ARG(const std::function<void()>&, std::move(function)));
12141214
}
12151215

1216+
void Host::RunOnGSThread(std::function<void()> function)
1217+
{
1218+
RunOnCPUThread([fn = std::move(function)]{ MTGS::RunOnGSThread(std::move(fn)); });
1219+
}
1220+
12161221
void Host::RefreshGameListAsync(bool invalidate_cache)
12171222
{
12181223
QMetaObject::invokeMethod(g_main_window, "refreshGameList", Qt::QueuedConnection, Q_ARG(bool, invalidate_cache));

pcsx2/Host.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ namespace Host
8888
/// Safely executes a function on the VM thread.
8989
void RunOnCPUThread(std::function<void()> function, bool block = false);
9090

91+
/// Safely executes a function on the GS thread.
92+
void RunOnGSThread(std::function<void()> function);
93+
9194
/// Asynchronously starts refreshing the game list.
9295
void RefreshGameListAsync(bool invalidate_cache);
9396

tests/ctest/core/StubHost.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ void Host::RunOnCPUThread(std::function<void()> function, bool block /* = false
157157
{
158158
}
159159

160+
void Host::RunOnGSThread(std::function<void()> function)
161+
{
162+
}
163+
160164
void Host::RefreshGameListAsync(bool invalidate_cache)
161165
{
162166
}

0 commit comments

Comments
 (0)