Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-03-02 18:31:29 +0300
committerbubnikv <bubnikv@gmail.com>2017-03-02 18:31:29 +0300
commitdff5bda202a70807aaff4db90a291bb40aaa9950 (patch)
treeb83e1b8911e4f3f3598c377a58e3d23c749bcbf0 /xs
parentbc19e97d4593fb98592d0f46021835c1ad627ea8 (diff)
The Shiny profiler is not thread safe. Disable parallelization if
SLIC3R_PROFILE is enabled.
Diffstat (limited to 'xs')
-rw-r--r--xs/src/libslic3r/libslic3r.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/xs/src/libslic3r/libslic3r.h b/xs/src/libslic3r/libslic3r.h
index c1223f5c2..0fe3ca53a 100644
--- a/xs/src/libslic3r/libslic3r.h
+++ b/xs/src/libslic3r/libslic3r.h
@@ -121,12 +121,20 @@ template <class T> void
parallelize(std::queue<T> queue, boost::function<void(T)> func,
int threads_count = boost::thread::hardware_concurrency())
{
- if (threads_count == 0) threads_count = 2;
+#ifdef SLIC3R_PROFILE
+ while (! queue.empty()) {
+ func(queue.front());
+ queue.pop();
+ }
+#else
+ if (threads_count == 0)
+ threads_count = 2;
boost::mutex queue_mutex;
boost::thread_group workers;
for (int i = 0; i < std::min(threads_count, int(queue.size())); ++ i)
workers.add_thread(new boost::thread(&_parallelize_do<T>, &queue, &queue_mutex, func));
workers.join_all();
+#endif
}
template <class T> void