File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ class MainSolver::ThreadImpl {
4444private:
4545 MainSolver & solver;
4646
47- std::jthread timeLimitThread{};
47+ // not using std::jthread since MacOS does not support it
48+ std::thread timeLimitThread{};
4849
4950 std::mutex mtx{};
5051 std::condition_variable condVar{};
@@ -632,7 +633,7 @@ MainSolver::ThreadImpl::~ThreadImpl() {
632633 if (not anyRunning ()) { return ; }
633634
634635 requestEnd ();
635- // no need to wait in destructor
636+ waitToEnd ();
636637}
637638
638639void MainSolver::ThreadImpl::setTimeLimit (std::chrono::milliseconds limit) {
@@ -641,12 +642,12 @@ void MainSolver::ThreadImpl::setTimeLimit(std::chrono::milliseconds limit) {
641642 waitToEnd ();
642643 }
643644
644- timeLimitThread = std::jthread ( [this , limit] {
645+ timeLimitThread = decltype (timeLimitThread){ [this , limit] {
645646 std::unique_lock lock (mtx);
646647 // To ensure that we do not wait later than when the notification was sent
647648 if (endReq) { return ; }
648649 if (condVar.wait_for (lock, limit) == std::cv_status::timeout) { solver.notifyStop (); }
649- }) ;
650+ }} ;
650651}
651652
652653bool MainSolver::ThreadImpl::anyRunning () const noexcept {
You can’t perform that action at this time.
0 commit comments