Add renderer and package readiness validation gates
This commit is contained in:
@@ -14,6 +14,9 @@ struct AppTaskDispatchPlan {
|
||||
bool notify_worker = false;
|
||||
bool wait_for_completion = false;
|
||||
bool request_redraw = false;
|
||||
// When true, dispatch attempts from non-target threads are rejected instead
|
||||
// of being queued for later execution.
|
||||
bool reject_unsafe_cross_thread_dispatch = false;
|
||||
};
|
||||
|
||||
struct AppAsyncRedrawPlan {
|
||||
@@ -73,16 +76,20 @@ struct AppThreadStopPlan {
|
||||
std::size_t queued_task_count,
|
||||
bool worker_running,
|
||||
bool wait_for_completion,
|
||||
bool request_redraw_after_dispatch) noexcept
|
||||
bool request_redraw_after_dispatch,
|
||||
bool reject_unsafe_cross_thread_dispatch = false) noexcept
|
||||
{
|
||||
const bool queue_task = !already_on_target_thread;
|
||||
const bool queue_task = !already_on_target_thread && !reject_unsafe_cross_thread_dispatch;
|
||||
return AppTaskDispatchPlan {
|
||||
.execute_immediately = already_on_target_thread,
|
||||
.queue_task = queue_task,
|
||||
.remove_matching_unique_task = queue_task && unique && queued_task_count > 0U,
|
||||
.notify_worker = queue_task,
|
||||
.wait_for_completion = queue_task && worker_running && wait_for_completion,
|
||||
.request_redraw = request_redraw_after_dispatch,
|
||||
.request_redraw = !(!already_on_target_thread && reject_unsafe_cross_thread_dispatch)
|
||||
&& request_redraw_after_dispatch,
|
||||
.reject_unsafe_cross_thread_dispatch = !already_on_target_thread
|
||||
&& reject_unsafe_cross_thread_dispatch,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user