Move canvas async work into app runtime
This commit is contained in:
@@ -45,6 +45,7 @@ public:
|
||||
void notify_render_worker() noexcept;
|
||||
void notify_ui_worker() noexcept;
|
||||
void prepared_file_task(std::function<void()> task);
|
||||
void canvas_async_task(std::function<void()> task);
|
||||
|
||||
void render_thread_tick(App& app);
|
||||
void render_thread_main(App& app, std::stop_token stop_token);
|
||||
@@ -205,6 +206,8 @@ public:
|
||||
private:
|
||||
void prepared_file_worker_main(std::stop_token stop_token);
|
||||
void prepared_file_worker_stop();
|
||||
void canvas_async_worker_main(std::stop_token stop_token);
|
||||
void canvas_async_worker_stop();
|
||||
|
||||
std::deque<std::function<void()>> prepared_file_tasklist_;
|
||||
std::mutex prepared_file_task_mutex_;
|
||||
@@ -212,6 +215,12 @@ private:
|
||||
std::jthread prepared_file_worker_;
|
||||
bool prepared_file_running_ = true;
|
||||
|
||||
std::deque<std::function<void()>> canvas_async_tasklist_;
|
||||
std::mutex canvas_async_task_mutex_;
|
||||
std::condition_variable canvas_async_cv_;
|
||||
std::jthread canvas_async_worker_;
|
||||
bool canvas_async_running_ = true;
|
||||
|
||||
std::deque<AppTask> render_tasklist_;
|
||||
std::mutex render_task_mutex_;
|
||||
std::condition_variable render_cv_;
|
||||
|
||||
Reference in New Issue
Block a user