mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 09:42:09 +08:00
Fix crash in gcc on Linux
This commit is contained in:
parent
ca824e095e
commit
155b152637
@ -81,9 +81,12 @@ std::future<void> BoostThreadWorker::call_on_main_thread(std::function<void ()>
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoostThreadWorker::BoostThreadWorker(std::shared_ptr<ProgressIndicator> pri,
|
BoostThreadWorker::BoostThreadWorker(std::shared_ptr<ProgressIndicator> pri,
|
||||||
boost::thread::attributes &attribs,
|
boost::thread::attributes &attribs,
|
||||||
const char * name)
|
const char *name)
|
||||||
: m_progress(std::move(pri)), m_input_queue{m_running}, m_output_queue{m_running}, m_name{name}
|
: m_progress(std::move(pri))
|
||||||
|
, m_input_queue{m_running}
|
||||||
|
, m_output_queue{m_running}
|
||||||
|
, m_name{name}
|
||||||
{
|
{
|
||||||
if (m_progress)
|
if (m_progress)
|
||||||
m_progress->set_cancel_callback([this](){ cancel(); });
|
m_progress->set_cancel_callback([this](){ cancel(); });
|
||||||
|
@ -69,7 +69,7 @@ class BoostThreadWorker : public Worker, private Job::Ctl
|
|||||||
|
|
||||||
template<class El>
|
template<class El>
|
||||||
class RawQueue: public std::deque<El> {
|
class RawQueue: public std::deque<El> {
|
||||||
std::atomic<bool> *m_running_ptr = nullptr;
|
std::atomic<bool> *m_running_ptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using std::deque<El>::deque;
|
using std::deque<El>::deque;
|
||||||
|
@ -21,6 +21,10 @@ struct BlockingWait
|
|||||||
unsigned timeout_ms = 0;
|
unsigned timeout_ms = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T, class... Args>
|
||||||
|
using NonSpecialMembersOnly = std::enable_if_t<
|
||||||
|
(sizeof...(Args) >= 1) && !(... || std::is_convertible_v<Args, T>)>;
|
||||||
|
|
||||||
// A thread safe queue for one producer and one consumer.
|
// A thread safe queue for one producer and one consumer.
|
||||||
template<class T,
|
template<class T,
|
||||||
template<class, class...> class Container = std::deque,
|
template<class, class...> class Container = std::deque,
|
||||||
@ -32,10 +36,11 @@ class ThreadSafeQueueSPSC
|
|||||||
std::condition_variable m_cond_var;
|
std::condition_variable m_cond_var;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<class...Qargs>
|
template<class...Qargs, class = NonSpecialMembersOnly<ThreadSafeQueueSPSC, Qargs...>>
|
||||||
ThreadSafeQueueSPSC(Qargs &&...qargs)
|
ThreadSafeQueueSPSC(Qargs &&...qargs)
|
||||||
: m_queue{Container<T, ContainerArgs...>{std::forward<Qargs>(qargs)...}} {}
|
: m_queue{Container<T, ContainerArgs...>{std::forward<Qargs>(qargs)...}} {}
|
||||||
|
|
||||||
|
ThreadSafeQueueSPSC() = default;
|
||||||
ThreadSafeQueueSPSC(const ThreadSafeQueueSPSC&) = default;
|
ThreadSafeQueueSPSC(const ThreadSafeQueueSPSC&) = default;
|
||||||
ThreadSafeQueueSPSC(ThreadSafeQueueSPSC&&) = default;
|
ThreadSafeQueueSPSC(ThreadSafeQueueSPSC&&) = default;
|
||||||
ThreadSafeQueueSPSC& operator=(const ThreadSafeQueueSPSC&) = default;
|
ThreadSafeQueueSPSC& operator=(const ThreadSafeQueueSPSC&) = default;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user