mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-02 08:30:38 +08:00
Add timeout for plater stopping the UI jobs.
This commit is contained in:
parent
35ca045b1c
commit
7eeffd6dca
@ -100,18 +100,18 @@ template<class...Args> bool replace_job(Worker &w, Args&& ...args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cancel the current job and wait for it to actually be stopped.
|
// Cancel the current job and wait for it to actually be stopped.
|
||||||
inline void stop_current_job(Worker &w, unsigned timeout_ms = 0)
|
inline bool stop_current_job(Worker &w, unsigned timeout_ms = 0)
|
||||||
{
|
{
|
||||||
w.cancel();
|
w.cancel();
|
||||||
w.wait_for_current_job(timeout_ms);
|
return w.wait_for_current_job(timeout_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel all pending jobs including current one and wait until the worker
|
// Cancel all pending jobs including current one and wait until the worker
|
||||||
// becomes idle.
|
// becomes idle.
|
||||||
inline void stop_queue(Worker &w, unsigned timeout_ms = 0)
|
inline bool stop_queue(Worker &w, unsigned timeout_ms = 0)
|
||||||
{
|
{
|
||||||
w.cancel_all();
|
w.cancel_all();
|
||||||
w.wait_for_idle(timeout_ms);
|
return w.wait_for_idle(timeout_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
@ -5892,8 +5892,14 @@ void Plater::reslice()
|
|||||||
if (canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
|
if (canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Stop arrange and (or) optimize rotation tasks.
|
// Stop the running (and queued) UI jobs and only proceed if they actually
|
||||||
stop_queue(this->get_ui_job_worker());
|
// get stopped.
|
||||||
|
unsigned timeout_ms = 10000;
|
||||||
|
if (!stop_queue(this->get_ui_job_worker(), timeout_ms)) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Could not stop UI job within "
|
||||||
|
<< timeout_ms << " milliseconds timeout!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (printer_technology() == ptSLA) {
|
if (printer_technology() == ptSLA) {
|
||||||
for (auto& object : model().objects)
|
for (auto& object : model().objects)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user