Fixing stack overflow issues when slicing in SLA mode:
The BackgroundSlicingProcess thread will now have the same stack size allocated as the TBB worker threads: 4MB on 64bit systems and 2MB on 32bit systems.
This commit is contained in:
parent
8503bb5213
commit
eb458163e3
@ -220,7 +220,11 @@ bool BackgroundSlicingProcess::start()
|
|||||||
if (m_state == STATE_INITIAL) {
|
if (m_state == STATE_INITIAL) {
|
||||||
// The worker thread is not running yet. Start it.
|
// The worker thread is not running yet. Start it.
|
||||||
assert(! m_thread.joinable());
|
assert(! m_thread.joinable());
|
||||||
m_thread = std::thread([this]{this->thread_proc_safe();});
|
boost::thread::attributes attrs;
|
||||||
|
// Duplicating the stack allocation size of Thread Building Block worker threads of the thread pool:
|
||||||
|
// allocate 4MB on a 64bit system, allocate 2MB on a 32bit system by default.
|
||||||
|
attrs.set_stack_size((sizeof(void*) == 4) ? (2048 * 1024) : (4096 * 1024));
|
||||||
|
m_thread = boost::thread(attrs, [this]{this->thread_proc_safe();});
|
||||||
// Wait until the worker thread is ready to execute the background processing task.
|
// Wait until the worker thread is ready to execute the background processing task.
|
||||||
m_condition.wait(lck, [this](){ return m_state == STATE_IDLE; });
|
m_condition.wait(lck, [this](){ return m_state == STATE_IDLE; });
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ private:
|
|||||||
PrintHostJob m_upload_job;
|
PrintHostJob m_upload_job;
|
||||||
// Thread, on which the background processing is executed. The thread will always be present
|
// Thread, on which the background processing is executed. The thread will always be present
|
||||||
// and ready to execute the slicing process.
|
// and ready to execute the slicing process.
|
||||||
std::thread m_thread;
|
boost::thread m_thread;
|
||||||
// Mutex and condition variable to synchronize m_thread with the UI thread.
|
// Mutex and condition variable to synchronize m_thread with the UI thread.
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::condition_variable m_condition;
|
std::condition_variable m_condition;
|
||||||
|
Loading…
Reference in New Issue
Block a user