initial port for Cevo game in C++ (libs)

This commit is contained in:
Geoffray Levasseur committed 2026-10-22 17:20:45 +02:00
commit 8436242032
375 files changed
+46282

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <functional>
namespace Cevo {
// Equivalent of Threading.pas's free functions (RunInThread/
// RunInThreadAsync/Synchronize). The TVirtualThread/TListedThread/
// TTermThread/TThreadList class hierarchy is NOT ported: it exists only to
// let a worker thread find "its own" wrapper object (via a global,
// mutex-guarded ThreadList keyed by TThreadID) so Synchronize() can call
// back into it - QThread + Qt::BlockingQueuedConnection already solve this
// natively, with no registry needed.
// Runs `method` on a new thread, blocking the caller until it finishes
// (pumping the Qt event loop meanwhile if called from the main thread).
// Re-throws whatever `method` threw.
void runInThread(const std::function<void()> &method);
// Runs `method` on a new thread without blocking; if given, `callback` runs
// (on that same worker thread) once `method` returns.
void runInThreadAsync(const std::function<void()> &method, const std::function<void()> &callback = {});
// Equivalent of TThread.Synchronize from a worker thread: runs `method` on
// the main/GUI thread, blocking the caller until it completes. Runs
// `method` directly, with no thread hop, if already on the main thread.
void synchronizeToMainThread(const std::function<void()> &method);
} // namespace Cevo