WIP on fixing deadlock with BoostThreadWorker

This commit is contained in:
tamasmeszaros 2023-10-09 13:14:42 +02:00
parent c9de26daf7
commit d1156ccefe
3 changed files with 11 additions and 2 deletions

View File

@ -118,7 +118,8 @@ public:
void clear()
{
std::lock_guard lk{m_mutex};
while (!m_queue.empty()) m_queue.pop();
while (!m_queue.empty())
m_queue.pop();
}
};

View File

@ -18,6 +18,6 @@ if (WIN32)
endif()
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
set(_catch_args "exclude:[NotWorking]")
set(_catch_args "exclude:[NotWorking];-s")
list(APPEND _catch_args "${CATCH_EXTRA_ARGS}")
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${_catch_args})

View File

@ -20,6 +20,14 @@ struct Progress: Slic3r::ProgressIndicator {
using TestClasses = std::tuple< Slic3r::GUI::UIThreadWorker, Slic3r::GUI::BoostThreadWorker >;
TEMPLATE_LIST_TEST_CASE("Empty worker should not block when queried for idle", "[Jobs]", TestClasses) {
TestType worker{std::make_unique<Progress>()};
worker.wait_for_idle();
REQUIRE(worker.is_idle());
}
TEMPLATE_LIST_TEST_CASE("Empty worker should not do anything", "[Jobs]", TestClasses) {
TestType worker{std::make_unique<Progress>()};