Trim recording loop and retain async worker state
This commit is contained in:
@@ -89,10 +89,19 @@ private:
|
||||
std::jthread worker_;
|
||||
};
|
||||
|
||||
LegacyPreparedFileWorker& prepared_file_worker()
|
||||
struct RetainedPreparedFileWorkerState final {
|
||||
void post(std::function<void()> task)
|
||||
{
|
||||
worker.post(std::move(task));
|
||||
}
|
||||
|
||||
LegacyPreparedFileWorker worker;
|
||||
};
|
||||
|
||||
RetainedPreparedFileWorkerState& retained_prepared_file_worker_state()
|
||||
{
|
||||
static LegacyPreparedFileWorker worker;
|
||||
return worker;
|
||||
static RetainedPreparedFileWorkerState state;
|
||||
return state;
|
||||
}
|
||||
|
||||
[[nodiscard]] GLint rgba8_internal_format() noexcept
|
||||
@@ -284,7 +293,7 @@ void App::pick_file_save(const std::string& type, const std::string& default_nam
|
||||
LOG("App::pick_file_save %s", target.path.c_str());
|
||||
if (target.write_on_background_thread) {
|
||||
auto* app = this;
|
||||
prepared_file_worker().post([
|
||||
retained_prepared_file_worker_state().post([
|
||||
app,
|
||||
writer = std::move(writer),
|
||||
callback = std::move(callback),
|
||||
|
||||
Reference in New Issue
Block a user