mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-19 16:20:01 -04:00
Triforce v0.5.0
In-game mods (GameBanana browser, search and installs, with the Mask Salesman), code-patch and cheat mods, the devs' test18 to test45 work (full performance overlay, frame pacing on, steady frame rate, save export and import, bug capture, new options rows, Setup's Mods page and Add to Steam), occlusion queries and new defaults, Auto resolution that scales, replay helper threads and robust buffers off by default, the options in sections.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// virtual cores, and the replay thread is one of the busiest.
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <exception>
|
||||
#include <condition_variable>
|
||||
#include <deque>
|
||||
@@ -133,6 +134,22 @@ void jobs_wait(const std::atomic<bool>& flag) {
|
||||
}
|
||||
done_cv.wait(lk, [&] { return flag.load(std::memory_order_acquire); });
|
||||
}
|
||||
bool jobs_wait_for(const std::atomic<bool>& flag, int ms) {
|
||||
std::unique_lock lk(mu);
|
||||
if (flag.load(std::memory_order_acquire)) return true;
|
||||
// ((Triforce) still queued: to the front, for the next worker that is free. Not run here, as jobs_wait does: this wait has
|
||||
// a bound, and a pipeline's compile on this thread would not keep it)
|
||||
for (auto it = queue.begin(); it != queue.end(); ++it)
|
||||
if (it->flag == &flag) {
|
||||
if (it != queue.begin()) {
|
||||
Entry e = std::move(*it);
|
||||
queue.erase(it);
|
||||
queue.push_front(std::move(e));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return done_cv.wait_for(lk, std::chrono::milliseconds(std::max(0, ms)), [&] { return flag.load(std::memory_order_acquire); });
|
||||
}
|
||||
int jobs_pending() {
|
||||
return pending.load();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user