pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
wip/prusaslicer: Update patches from adapted upstream commit.
Module Name: pkgsrc-wip
Committed By: Paul Ripke <stix%stix.id.au@localhost>
Pushed By: stix
Date: Tue Aug 31 00:34:23 2021 +1000
Changeset: e8603e89ae47f67ef3c35f104e1dd045aab83476
Modified Files:
prusaslicer/distinfo
prusaslicer/patches/patch-src_avrdude_libavrdude.h
prusaslicer/patches/patch-src_libslic3r_Print.cpp
prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
prusaslicer/patches/patch-src_libslic3r_Thread.cpp
prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
prusaslicer/patches/patch-src_libslic3r_utils.cpp
prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp
Log Message:
wip/prusaslicer: Update patches from adapted upstream commit.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e8603e89ae47f67ef3c35f104e1dd045aab83476
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
prusaslicer/distinfo | 38 +++++-----
prusaslicer/patches/patch-src_avrdude_libavrdude.h | 6 +-
prusaslicer/patches/patch-src_libslic3r_Print.cpp | 9 +--
.../patches/patch-src_libslic3r_PrintBase.cpp | 3 +-
.../patches/patch-src_libslic3r_PrintBase.hpp | 40 ++++-------
.../patches/patch-src_libslic3r_PrintObject.cpp | 3 +-
.../patches/patch-src_libslic3r_SLAPrint.cpp | 11 +--
.../patch-src_libslic3r_SLA_Concurrency.hpp | 3 +-
.../patch-src_libslic3r_SLA_SupportTree.cpp | 11 +--
.../patch-src_libslic3r_SupportMaterial.cpp | 3 +-
prusaslicer/patches/patch-src_libslic3r_Thread.cpp | 82 +++++++++++++---------
.../patches/patch-src_libslic3r_pchheader.hpp | 13 +---
prusaslicer/patches/patch-src_libslic3r_utils.cpp | 9 ++-
...tch-src_slic3r_GUI_BackgroundSlicingProcess.cpp | 9 +--
...tch-src_slic3r_GUI_BackgroundSlicingProcess.hpp | 3 +-
.../patches/patch-src_slic3r_GUI_InstanceCheck.hpp | 6 +-
.../patch-src_slic3r_GUI_Mouse3DController.cpp | 49 +++++++------
.../patch-src_slic3r_GUI_Mouse3DController.hpp | 18 ++---
.../patch-src_slic3r_GUI_RemovableDriveManager.cpp | 32 ++++-----
.../patch-src_slic3r_GUI_RemovableDriveManager.hpp | 11 ++-
20 files changed, 187 insertions(+), 172 deletions(-)
diffs:
diff --git a/prusaslicer/distinfo b/prusaslicer/distinfo
index d892b47267..5e0b3a3503 100644
--- a/prusaslicer/distinfo
+++ b/prusaslicer/distinfo
@@ -10,25 +10,25 @@ SHA1 (patch-cmake_modules_FindTBB.cmake) = bb2e4fcc30d0f98b082ecbe98c0c2032488e5
SHA1 (patch-src_CMakeLists_txt) = 1ec421e911ef96ae412643216080e1f26e5282c4
SHA1 (patch-src_PrusaSlicer.cpp) = 130cfa729f8daf68a76a3face4934dfa55dcdb80
SHA1 (patch-src_avrdude_arduino.c) = ff02a4cab1c2d8c82ec7b22c7447ed5ec360ac57
-SHA1 (patch-src_avrdude_libavrdude.h) = 414cf7c6c23f7eed61319f8580c1dd7218ac4337
+SHA1 (patch-src_avrdude_libavrdude.h) = 62d48054b147985249664f257dbd8bbd670df233
SHA1 (patch-src_libslic3r_Platform.cpp) = bc417c037cf26f0c72c34bfd2c44ea7ebd177e9e
SHA1 (patch-src_libslic3r_Platform.hpp) = 5cb5946e30c8cfad305a6d6ee2efd2718eeadeb3
-SHA1 (patch-src_libslic3r_Print.cpp) = 13c0472088277c79bfaedbe9d74deecf9eae8bad
-SHA1 (patch-src_libslic3r_PrintBase.cpp) = d6f6983933215a0b95e390cef32dcb33d5becd59
-SHA1 (patch-src_libslic3r_PrintBase.hpp) = f23c49add9c9bffe6b253308b7d85fe510462f97
-SHA1 (patch-src_libslic3r_PrintObject.cpp) = 491a8966d3b6b92d9ab8fd6186e61f9743a30463
-SHA1 (patch-src_libslic3r_SLAPrint.cpp) = d1cb835e529e76d9ace89673a6bfabe8051ce899
-SHA1 (patch-src_libslic3r_SLA_Concurrency.hpp) = 5ed50b06bbe5c5b08b3e473586d76d0813eaf265
-SHA1 (patch-src_libslic3r_SLA_SupportTree.cpp) = 4d9929c06f3d23e795b71687d0ac1d4e4823934b
-SHA1 (patch-src_libslic3r_SupportMaterial.cpp) = 57783d96e293993ea9cf264c5ba4061f6c1b881a
-SHA1 (patch-src_libslic3r_Thread.cpp) = fc6b7bc4fb0f1ddc1409e824898ba5259f0da72d
-SHA1 (patch-src_libslic3r_pchheader.hpp) = 8235c1d973bbf5bd3accba96f8d4519793495f87
-SHA1 (patch-src_libslic3r_utils.cpp) = 1ae1daa5146d04c907cd88c2b6618345fc79719f
-SHA1 (patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp) = f7ea43adb2da1d5776e58dd18a8ec041a6eabe5a
-SHA1 (patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp) = cad5e01db6cabea14b332e8e1c14ef1e50e530a9
+SHA1 (patch-src_libslic3r_Print.cpp) = 9b8363c3550e5bb66a475ef3db2960ae07b860b8
+SHA1 (patch-src_libslic3r_PrintBase.cpp) = 1ecc626f929a0efbffae99219a771bb0d57465cd
+SHA1 (patch-src_libslic3r_PrintBase.hpp) = 8e42b2356c82fa5864975df4a1872f06d757a9f0
+SHA1 (patch-src_libslic3r_PrintObject.cpp) = b9c2fbd23d901ca5396fc0d5d5c85c26dad2f259
+SHA1 (patch-src_libslic3r_SLAPrint.cpp) = 3ba47b00ba00557cc6d7f6a1e055949a3f0eb0a9
+SHA1 (patch-src_libslic3r_SLA_Concurrency.hpp) = f64e4c2ebf8348972db54472e745ca1e4e6951b3
+SHA1 (patch-src_libslic3r_SLA_SupportTree.cpp) = 98e857e28642e2da7344ba94580c27845d277617
+SHA1 (patch-src_libslic3r_SupportMaterial.cpp) = 14d196e8a983bc2151b2003f0659a731c2738e5e
+SHA1 (patch-src_libslic3r_Thread.cpp) = b58e64288f81c6344de80923aad14ddc12a4aa0a
+SHA1 (patch-src_libslic3r_pchheader.hpp) = 95d15bceb7140e6895bedaa4513531dd90855abe
+SHA1 (patch-src_libslic3r_utils.cpp) = 33d04b0883198091531c444b595e9e29b8d9f165
+SHA1 (patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp) = 15b0d124e6a75f9c198bc4d14c7712d46b8ac099
+SHA1 (patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp) = b22658059ad2cc3c3ec510949157922ca7c79d54
SHA1 (patch-src_slic3r_GUI_InstanceCheck.cpp) = c9ae1ec2db2b493578cc128383fa4cf0b3e2ae6a
-SHA1 (patch-src_slic3r_GUI_InstanceCheck.hpp) = e87206bc16155d575cf6b258c52429215c1b2c0c
-SHA1 (patch-src_slic3r_GUI_Mouse3DController.cpp) = 41018efeba4c0d5904df5d5df59db1540183a0fe
-SHA1 (patch-src_slic3r_GUI_Mouse3DController.hpp) = e99c46c4424d1087fbe0ca17504d2302e5662928
-SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.cpp) = d54f0b7f62623cb745786526c6424ac53e6b6630
-SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.hpp) = 4999ee81ab603dc513494ccf65dcf6c3a015bbbd
+SHA1 (patch-src_slic3r_GUI_InstanceCheck.hpp) = 6ec1f000be65a65b6a2ca441d0da9d2defd62634
+SHA1 (patch-src_slic3r_GUI_Mouse3DController.cpp) = 7fb94a9949bc83057e0b0c8d77852e3e6df97f03
+SHA1 (patch-src_slic3r_GUI_Mouse3DController.hpp) = e22b1c018d870a099744e21d23731656a516d4f5
+SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.cpp) = 37853e71f828bde540340b71935e526576e285d0
+SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.hpp) = 5e87f153d560db5be1acbce54b416c15aaba6039
diff --git a/prusaslicer/patches/patch-src_avrdude_libavrdude.h b/prusaslicer/patches/patch-src_avrdude_libavrdude.h
index 303b61de4c..b488bcbef9 100644
--- a/prusaslicer/patches/patch-src_avrdude_libavrdude.h
+++ b/prusaslicer/patches/patch-src_avrdude_libavrdude.h
@@ -1,15 +1,15 @@
$NetBSD$
-alloca.h is Linux specific.
+alloca.h is only found on Linux+Darwin.
---- src/avrdude/libavrdude.h.orig 2020-03-21 10:55:51.000000000 +0000
+--- src/avrdude/libavrdude.h.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/avrdude/libavrdude.h
@@ -950,7 +950,7 @@ int read_config_builtin();
// Header file for alloca()
#if defined(WIN32NATIVE)
# include <malloc.h>
-#else
-+#elif defined(__linux__)
++#elif defined(__linux__) || defined(__APPLE__)
# include <alloca.h>
#endif
diff --git a/prusaslicer/patches/patch-src_libslic3r_Print.cpp b/prusaslicer/patches/patch-src_libslic3r_Print.cpp
index d217622b06..4f53246796 100644
--- a/prusaslicer/patches/patch-src_libslic3r_Print.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_Print.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/Print.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/Print.cpp
@@ -9,7 +10,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
void Print::clear()
{
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
// The following call should stop background processing if it is running.
this->invalidate_all_steps();
for (PrintObject *object : m_objects)
@@ -18,7 +19,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
if (m_objects.empty())
return false;
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
for (const PrintObject *object : m_objects)
if (! object->is_step_done_unguarded(step))
return false;
@@ -27,7 +28,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Grab the lock for the Print / PrintObject milestones.
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
// The following call may stop the background processing.
if (! print_diff.empty())
diff --git a/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp b/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
index 6777d5bef8..2602a69fd7 100644
--- a/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/PrintBase.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/PrintBase.cpp
diff --git a/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp b/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
index 44d73bbb77..9633e6ca2a 100644
--- a/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
+++ b/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
@@ -1,30 +1,25 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
-Migrate from deprecated tbb::atomic to std::atomic.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/PrintBase.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/PrintBase.hpp
-@@ -2,17 +2,13 @@
- #define slic3r_PrintBase_hpp_
-
- #include "libslic3r.h"
-+#include <atomic>
- #include <set>
+@@ -6,12 +6,8 @@
#include <vector>
-+#include <mutex>
#include <string>
#include <functional>
-
+-
-// tbb/mutex.h includes Windows, which in turn defines min/max macros. Convince Windows.h to not define these min/max macros.
-#ifndef NOMINMAX
- #define NOMINMAX
-#endif
-#include "tbb/mutex.h"
--
++#include <atomic>
++#include <mutex>
+
#include "ObjectID.hpp"
#include "Model.hpp"
- #include "PlaceholderParser.hpp"
@@ -84,23 +80,23 @@ class PrintState : public PrintStateBase
public:
PrintState() {}
@@ -32,7 +27,7 @@ Migrate from deprecated tbb::atomic to std::atomic.
- StateWithTimeStamp state_with_timestamp(StepType step, tbb::mutex &mtx) const {
- tbb::mutex::scoped_lock lock(mtx);
+ StateWithTimeStamp state_with_timestamp(StepType step, std::mutex &mtx) const {
-+ std::lock_guard<std::mutex> lock(mtx);
++ std::scoped_lock<std::mutex> lock(mtx);
StateWithTimeStamp state = m_state[step];
return state;
}
@@ -40,7 +35,7 @@ Migrate from deprecated tbb::atomic to std::atomic.
- StateWithWarnings state_with_warnings(StepType step, tbb::mutex &mtx) const {
- tbb::mutex::scoped_lock lock(mtx);
+ StateWithWarnings state_with_warnings(StepType step, std::mutex &mtx) const {
-+ std::lock_guard<std::mutex> lock(mtx);
++ std::scoped_lock<std::mutex> lock(mtx);
StateWithWarnings state = m_state[step];
return state;
}
@@ -62,7 +57,7 @@ Migrate from deprecated tbb::atomic to std::atomic.
- bool set_started(StepType step, tbb::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
- tbb::mutex::scoped_lock lock(mtx);
+ bool set_started(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
-+ std::lock_guard<std::mutex> lock(mtx);
++ std::scoped_lock<std::mutex> lock(mtx);
// If canceled, throw before changing the step state.
throw_if_canceled();
#ifndef NDEBUG
@@ -73,7 +68,7 @@ Migrate from deprecated tbb::atomic to std::atomic.
- std::pair<TimeStamp, bool> set_done(StepType step, tbb::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
- tbb::mutex::scoped_lock lock(mtx);
+ std::pair<TimeStamp, bool> set_done(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
-+ std::lock_guard<std::mutex> lock(mtx);
++ std::scoped_lock<std::mutex> lock(mtx);
// If canceled, throw before changing the step state.
throw_if_canceled();
assert(m_state[step].state == STARTED);
@@ -85,7 +80,7 @@ Migrate from deprecated tbb::atomic to std::atomic.
+ std::pair<StepType, bool> active_step_add_warning(PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id, std::mutex &mtx)
{
- tbb::mutex::scoped_lock lock(mtx);
-+ std::lock_guard<std::mutex> lock(mtx);
++ std::scoped_lock<std::mutex> lock(mtx);
assert(m_step_active != -1);
StateWithWarnings &state = m_state[m_step_active];
assert(state.state == STARTED);
@@ -107,21 +102,12 @@ Migrate from deprecated tbb::atomic to std::atomic.
std::function<void()> cancel_callback() { return m_cancel_callback; }
void call_cancel_callback() { m_cancel_callback(); }
// Notify UI about a new warning of a milestone "step" on this PrintBase.
-@@ -471,7 +467,7 @@ protected:
-
- // If the background processing stop was requested, throw CanceledException.
- // To be called by the worker thread and its sub-threads (mostly launched on the TBB thread pool) regularly.
-- void throw_if_canceled() const { if (m_cancel_status) throw CanceledException(); }
-+ void throw_if_canceled() const { if (canceled()) throw CanceledException(); }
-
- // To be called by this->output_filename() with the format string pulled from the configuration layer.
- std::string output_filename(const std::string &format, const std::string &default_ext, const std::string &filename_base, const DynamicConfig *config_override = nullptr) const;
@@ -486,7 +482,7 @@ protected:
status_callback_type m_status_callback;
private:
- tbb::atomic<CancelStatus> m_cancel_status;
-+ std::atomic<CancelStatus> m_cancel_status {NOT_CANCELED};
++ std::atomic<CancelStatus> m_cancel_status;
// Callback to be evoked to stop the background processing before a state is updated.
cancel_callback_type m_cancel_callback = [](){};
diff --git a/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp b/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
index 22ea3af6e7..20e2d1d2f5 100644
--- a/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::atomic to std::atomic.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/PrintObject.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/PrintObject.cpp
diff --git a/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp b/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
index 7f6cbd726a..a7dc9c2660 100644
--- a/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/SLAPrint.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/SLAPrint.cpp
@@ -18,7 +19,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
void SLAPrint::clear()
{
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
// The following call should stop background processing if it is running.
this->invalidate_all_steps();
for (SLAPrintObject *object : m_objects)
@@ -27,7 +28,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Grab the lock for the Print / PrintObject milestones.
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
// The following call may stop the background processing.
bool invalidate_all_model_objects = false;
@@ -36,7 +37,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
{
// Grab the lock for the Print / PrintObject milestones.
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
int n_object_steps = int(params.to_object_step) + 1;
if (n_object_steps == 0)
@@ -45,7 +46,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
if (m_objects.empty())
return false;
- tbb::mutex::scoped_lock lock(this->state_mutex());
-+ std::lock_guard<std::mutex> lock(this->state_mutex());
++ std::scoped_lock<std::mutex> lock(this->state_mutex());
for (const SLAPrintObject *object : m_objects)
if (! object->is_step_done_unguarded(step))
return false;
diff --git a/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp b/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
index 8612786cff..4b40252e99 100644
--- a/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
+++ b/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/SLA/Concurrency.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/SLA/Concurrency.hpp
diff --git a/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp b/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
index 7fb3c2f422..e8a1234aba 100644
--- a/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
@@ -1,14 +1,17 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/SLA/SupportTree.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/SLA/SupportTree.cpp
-@@ -17,7 +17,6 @@
+@@ -16,9 +16,6 @@
+ #include <libnest2d/optimizers/nlopt/genetic.hpp>
#include <libnest2d/optimizers/nlopt/subplex.hpp>
#include <boost/log/trivial.hpp>
- #include <tbb/parallel_for.h>
+-#include <tbb/parallel_for.h>
-#include <tbb/mutex.h>
- #include <tbb/spin_mutex.h>
+-#include <tbb/spin_mutex.h>
#include <libslic3r/I18N.hpp>
+ //! macro used to mark string used at localization,
diff --git a/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp b/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
index a1672c8fe8..944af9550c 100644
--- a/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::atomic to std::atomic.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/SupportMaterial.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/SupportMaterial.cpp
diff --git a/prusaslicer/patches/patch-src_libslic3r_Thread.cpp b/prusaslicer/patches/patch-src_libslic3r_Thread.cpp
index ae8bd8c75c..232e0afa69 100644
--- a/prusaslicer/patches/patch-src_libslic3r_Thread.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_Thread.cpp
@@ -1,14 +1,16 @@
$NetBSD$
pthread_setname_np takes 3 arguments on NetBSD.
-Remove use of deprecated tbb::task_scheduler_init, tbb::thread.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/Thread.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/Thread.cpp
-@@ -9,10 +9,9 @@
+@@ -9,10 +9,10 @@
#include <atomic>
#include <condition_variable>
#include <mutex>
++#include <thread>
+#include <tbb/global_control.h>
#include <tbb/parallel_for.h>
-#include <tbb/tbb_thread.h>
@@ -17,46 +19,62 @@ Remove use of deprecated tbb::task_scheduler_init, tbb::thread.
#include "Thread.hpp"
-@@ -161,19 +160,31 @@ std::optional<std::string> get_current_t
- // posix
- bool set_thread_name(std::thread &thread, const char *thread_name)
- {
-+#ifdef __NetBSD__
-+ pthread_setname_np(thread.native_handle(), thread_name, nullptr);
-+#else
- pthread_setname_np(thread.native_handle(), thread_name);
-+#endif
- return true;
+@@ -156,6 +156,36 @@ std::optional<std::string> get_current_t
+ return std::nullopt;
}
- bool set_thread_name(boost::thread &thread, const char *thread_name)
- {
++#else // __APPLE__
++
+#ifdef __NetBSD__
++
++// pthread_setname_np takes 3 args on NetBSD.
++
++bool set_thread_name(std::thread &thread, const char *thread_name)
++{
+ pthread_setname_np(thread.native_handle(), thread_name, nullptr);
-+#else
- pthread_setname_np(thread.native_handle(), thread_name);
-+#endif
- return true;
- }
-
- bool set_current_thread_name(const char *thread_name)
- {
-+#ifdef __NetBSD__
++ return true;
++}
++
++bool set_thread_name(boost::thread &thread, const char *thread_name)
++{
++ pthread_setname_np(thread.native_handle(), thread_name, nullptr);
++ return true;
++}
++
++bool set_current_thread_name(const char *thread_name)
++{
+ pthread_setname_np(pthread_self(), thread_name, nullptr);
-+#else
- pthread_setname_np(pthread_self(), thread_name);
-+#endif
- return true;
++ return true;
++}
++
++std::optional<std::string> get_current_thread_name()
++{
++ char buf[16];
++ return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");
++}
++
+ #else
+
+ // posix
+@@ -183,7 +213,9 @@ std::optional<std::string> get_current_t
+ return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");
}
-@@ -206,13 +217,14 @@ void name_tbb_thread_pool_threads()
+-#endif
++#endif // __NetBSD__
++
++#endif // __APPLE__
+
+ #endif // _WIN32
+
+@@ -206,13 +238,13 @@ void name_tbb_thread_pool_threads()
nthreads = 1;
#endif
-+ static tbb::global_control *tbb_global = nullptr;
- if (nthreads != nthreads_hw)
+- if (nthreads != nthreads_hw)
- new tbb::task_scheduler_init(int(nthreads));
-+ tbb_global = new tbb::global_control(tbb::global_control::max_allowed_parallelism, nthreads);
++ if (nthreads != nthreads_hw)
++ tbb::global_control(tbb::global_control::max_allowed_parallelism, nthreads);
std::atomic<size_t> nthreads_running(0);
std::condition_variable cv;
@@ -66,7 +84,7 @@ Remove use of deprecated tbb::task_scheduler_init, tbb::thread.
tbb::parallel_for(
tbb::blocked_range<size_t>(0, nthreads, 1),
[&nthreads_running, nthreads, &master_thread_id, &cv, &cv_m](const tbb::blocked_range<size_t> &range) {
-@@ -226,7 +238,7 @@ void name_tbb_thread_pool_threads()
+@@ -226,7 +258,7 @@ void name_tbb_thread_pool_threads()
std::unique_lock<std::mutex> lk(cv_m);
cv.wait(lk, [&nthreads_running, nthreads]{return nthreads_running == nthreads;});
}
diff --git a/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp b/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
index 33e9896777..39dc8a883a 100644
--- a/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
+++ b/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
@@ -1,18 +1,11 @@
$NetBSD$
-Remove use of deprecated tbb::atomic, tbb::mutex, tbb::task_scheduler_init.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/pchheader.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/pchheader.hpp
-@@ -35,6 +35,7 @@
- #include <locale>
- #include <map>
- #include <memory>
-+#include <mutex>
- #include <numeric>
- #include <ostream>
- #include <queue>
-@@ -93,12 +94,9 @@
+@@ -93,12 +93,9 @@
#include <boost/thread.hpp>
#include <boost/version.hpp>
diff --git a/prusaslicer/patches/patch-src_libslic3r_utils.cpp b/prusaslicer/patches/patch-src_libslic3r_utils.cpp
index e733bcefa4..fbc68bbf85 100644
--- a/prusaslicer/patches/patch-src_libslic3r_utils.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_utils.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Remove use of deprecated tbb::task_scheduler_init.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/libslic3r/utils.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/libslic3r/utils.cpp
@@ -13,16 +14,14 @@ Remove use of deprecated tbb::task_scheduler_init.
#if defined(__linux__) || defined(__GNUC__ )
#include <strings.h>
-@@ -118,9 +118,9 @@ void trace(unsigned int level, const cha
+@@ -118,9 +118,7 @@ void trace(unsigned int level, const cha
void disable_multi_threading()
{
// Disable parallelization so the Shiny profiler works
- static tbb::task_scheduler_init *tbb_init = nullptr;
- if (tbb_init == nullptr)
- tbb_init = new tbb::task_scheduler_init(1);
-+ static tbb::global_control *tbb_global = nullptr;
-+ if (tbb_global == nullptr)
-+ tbb_global = new tbb::global_control(tbb::global_control::max_allowed_parallelism, 1);
++ tbb::global_control(tbb::global_control::max_allowed_parallelism, 1);
}
static std::string g_var_dir;
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
index 9c311c487a..d02bb5651a 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/BackgroundSlicingProcess.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/BackgroundSlicingProcess.cpp
@@ -9,7 +10,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Guard against entering the export step before changing the export path.
- tbb::mutex::scoped_lock lock(m_print->state_mutex());
-+ std::lock_guard<std::mutex> lock(m_print->state_mutex());
++ std::scoped_lock<std::mutex> lock(m_print->state_mutex());
this->invalidate_step(bspsGCodeFinalize);
m_export_path = path;
m_export_path_on_removable_media = export_path_on_removable_media;
@@ -18,7 +19,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Guard against entering the export step before changing the export path.
- tbb::mutex::scoped_lock lock(m_print->state_mutex());
-+ std::lock_guard<std::mutex> lock(m_print->state_mutex());
++ std::scoped_lock<std::mutex> lock(m_print->state_mutex());
this->invalidate_step(bspsGCodeFinalize);
m_export_path.clear();
m_upload_job = std::move(upload_job);
@@ -27,7 +28,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
m_export_path_on_removable_media = false;
// invalidate_step expects the mutex to be locked.
- tbb::mutex::scoped_lock lock(m_print->state_mutex());
-+ std::lock_guard<std::mutex> lock(m_print->state_mutex());
++ std::scoped_lock<std::mutex> lock(m_print->state_mutex());
this->invalidate_step(bspsGCodeFinalize);
}
}
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
index 1562849baa..abbff925eb 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/BackgroundSlicingProcess.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/BackgroundSlicingProcess.hpp
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
index 39fac50e7a..5d6cb5ce2f 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
@@ -1,14 +1,16 @@
$NetBSD$
-Remove use of deprecated tbb::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/InstanceCheck.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/InstanceCheck.hpp
-@@ -13,7 +13,6 @@
+@@ -13,7 +13,7 @@
#if __linux__
#include <boost/thread.hpp>
-#include <tbb/mutex.h>
++#include <mutex>
#include <condition_variable>
#endif // __linux__
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
index 6663041ac7..5b1b2a321c 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/Mouse3DController.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/Mouse3DController.cpp
@@ -9,7 +10,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
void Mouse3DController::State::append_translation(const Vec3d& translation, size_t input_queue_max_size)
{
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
while (m_input_queue.size() >= input_queue_max_size)
m_input_queue.pop_front();
m_input_queue.emplace_back(QueueItem::translation(translation));
@@ -18,7 +19,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
void Mouse3DController::State::append_rotation(const Vec3f& rotation, size_t input_queue_max_size)
{
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
while (m_input_queue.size() >= input_queue_max_size)
m_input_queue.pop_front();
m_input_queue.emplace_back(QueueItem::rotation(rotation.cast<double>()));
@@ -27,7 +28,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
void Mouse3DController::State::append_button(unsigned int id, size_t /* input_queue_max_size */)
{
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
m_input_queue.emplace_back(QueueItem::buttons(id));
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
update_maximum(input_queue_max_size_achieved, m_input_queue.size());
@@ -36,7 +37,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
m_device_str = format_device_string(vid, pid);
if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
m_params = m_params_ui = it_params->second;
}
else
@@ -45,25 +46,33 @@ Migrate from deprecated tbb::mutex to std::mutex.
if (sscanf(device.c_str(), "\\\\?\\HID#VID_%x&PID_%x&", &vid, &pid) == 2) {
if (std::find(_3DCONNEXION_VENDORS.begin(), _3DCONNEXION_VENDORS.end(), vid) != _3DCONNEXION_VENDORS.end()) {
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
m_params_by_device[format_device_string(vid, pid)] = m_params_ui;
}
}
-@@ -307,7 +307,7 @@ void Mouse3DController::device_detached(
+@@ -307,12 +307,12 @@ void Mouse3DController::device_detached(
// Filter out mouse scroll events produced by the 3DConnexion driver.
bool Mouse3DController::State::process_mouse_wheel()
{
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
- if (m_mouse_wheel_counter == 0)
- // No 3DConnexion rotation has been captured since the last mouse scroll event.
+- if (m_mouse_wheel_counter == 0)
+- // No 3DConnexion rotation has been captured since the last mouse scroll event.
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
++ if (m_mouse_wheel_counter == 0)
++ // No 3DConnexion rotation has been captured since the last mouse scroll event.
return false;
+ if (std::find_if(m_input_queue.begin(), m_input_queue.end(), [](const QueueItem &item){ return item.is_rotation(); }) != m_input_queue.end()) {
+- // There is a rotation stored in the queue. Suppress one mouse scroll event.
++ // There is a rotation stored in the queue. Suppress one mouse scroll event.
+ -- m_mouse_wheel_counter;
+ return true;
+ }
@@ -329,7 +329,7 @@ bool Mouse3DController::State::apply(con
std::deque<QueueItem> input_queue;
{
// Atomically move m_input_queue to input_queue.
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
input_queue = std::move(m_input_queue);
m_input_queue.clear();
}
@@ -72,7 +81,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
#ifdef _WIN32
{
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
if (m_params_ui_changed) {
m_params = m_params_ui;
m_params_ui_changed = false;
@@ -81,7 +90,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
bool params_changed = false;
{
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
params_copy = m_params_ui;
}
@@ -90,7 +99,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
if (params_changed) {
// Synchronize front end parameters to back end.
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
auto pthis = const_cast<Mouse3DController*>(this);
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
if (params_copy.input_queue_max_size != params_copy.input_queue_max_size)
@@ -99,7 +108,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Copy the parameters for m_device_str into the current parameters.
if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
m_params = m_params_ui = it_params->second;
}
m_connected = true;
@@ -108,7 +117,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
assert(m_connected == ! m_device_str.empty());
if (m_connected) {
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
m_params_by_device[m_device_str] = m_params_ui;
m_device_str.clear();
m_connected = false;
@@ -117,7 +126,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Synchronize parameters between the UI thread and the background thread.
//FIXME is this necessary on OSX? Are these notifications triggered from the main thread or from a worker thread?
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
if (m_params_ui_changed) {
m_params = m_params_ui;
m_params_ui_changed = false;
@@ -126,7 +135,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
for (;;) {
{
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
if (m_stop)
break;
if (m_params_ui_changed) {
@@ -135,7 +144,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Copy the parameters for m_device_str into the current parameters.
if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
m_params = m_params_ui = it_params->second;
}
}
@@ -144,7 +153,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Copy the current parameters for m_device_str into the parameter database.
{
- tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+ std::lock_guard<std::mutex> lock(m_params_ui_mutex);
++ std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
m_params_by_device[m_device_str] = m_params_ui;
}
m_device_str.clear();
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
index b8f724fc6d..97cc39d568 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
@@ -1,11 +1,12 @@
$NetBSD$
pkgsrc hidapi.h is one level deeper than builtin.
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/Mouse3DController.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/Mouse3DController.hpp
-@@ -6,17 +6,16 @@
+@@ -6,16 +6,16 @@
#include "libslic3r/Point.hpp"
@@ -21,11 +22,10 @@ Migrate from deprecated tbb::mutex to std::mutex.
#include <condition_variable>
-#include <tbb/mutex.h>
--
+
namespace Slic3r {
- class AppConfig;
-@@ -85,7 +84,7 @@ class Mouse3DController
+@@ -85,7 +85,7 @@ class Mouse3DController
// m_input_queue is accessed by the background thread and by the UI thread. Access to m_input_queue
// is guarded with m_input_queue_mutex.
std::deque<QueueItem> m_input_queue;
@@ -34,22 +34,22 @@ Migrate from deprecated tbb::mutex to std::mutex.
#ifdef WIN32
// When the 3Dconnexion driver is running the system gets, by default, mouse wheel events when rotations around the X axis are detected.
-@@ -112,12 +111,12 @@ class Mouse3DController
+@@ -112,12 +112,12 @@ class Mouse3DController
#if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
Vec3d get_first_vector_of_type(unsigned int type) const {
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
auto it = std::find_if(m_input_queue.begin(), m_input_queue.end(), [type](const QueueItem& item) { return item.type_or_buttons == type; });
return (it == m_input_queue.end()) ? Vec3d::Zero() : it->vector;
}
size_t input_queue_size_current() const {
- tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+ std::lock_guard<std::mutex> lock(m_input_queue_mutex);
++ std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
return m_input_queue.size();
}
std::atomic<size_t> input_queue_max_size_achieved;
-@@ -133,7 +132,7 @@ class Mouse3DController
+@@ -133,7 +133,7 @@ class Mouse3DController
// UI thread will read / write this copy.
Params m_params_ui;
bool m_params_ui_changed { false };
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
index c8433142b8..a1c940824e 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
@@ -1,6 +1,7 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/RemovableDriveManager.cpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/RemovableDriveManager.cpp
@@ -9,7 +10,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
#endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
BOOST_LOG_TRIVIAL(info) << "Ejecting started";
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
auto it_drive_data = this->find_last_save_path_drive_data();
if (it_drive_data != m_current_drives.end()) {
// get handle to device
@@ -18,7 +19,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
#endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
if (m_current_drives.empty())
return std::string();
std::size_t found = path.find_last_of("\\");
@@ -27,7 +28,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
std::string RemovableDriveManager::get_removable_drive_from_path(const std::string& path)
{
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
std::size_t found = path.find_last_of("\\");
std::string new_path = path.substr(0, found);
int letter = PathGetDriveNumberW(boost::nowide::widen(new_path).c_str());
@@ -36,7 +37,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
DriveData drive_data;
{
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
auto it_drive_data = this->find_last_save_path_drive_data();
if (it_drive_data == m_current_drives.end())
return;
@@ -45,7 +46,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// Remove the drive_data from m_current drives, searching by value, not by pointer, as m_current_drives may get modified during
// asynchronous execution on m_eject_thread.
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
auto it = std::find(m_current_drives.begin(), m_current_drives.end(), drive_data);
if (it != m_current_drives.end())
m_current_drives.erase(it);
@@ -54,7 +55,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
std::string new_path = found == path.size() - 1 ? path.substr(0, found) : path;
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
for (const DriveData &data : m_current_drives)
if (search_for_drives_internal::compare_filesystem_id(new_path, data.path))
return path;
@@ -63,7 +64,7 @@ Migrate from deprecated tbb::mutex to std::mutex.
// check if same filesystem
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
for (const DriveData &drive_data : m_current_drives)
if (search_for_drives_internal::compare_filesystem_id(new_path, drive_data.path))
return drive_data.path;
@@ -72,38 +73,37 @@ Migrate from deprecated tbb::mutex to std::mutex.
RemovableDriveManager::RemovableDrivesStatus out;
{
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
out.has_eject =
// Cannot control eject on Chromium.
platform_flavor() != PlatformFlavor::LinuxOnChromium &&
-@@ -468,17 +468,16 @@ RemovableDriveManager::RemovableDrivesSt
+@@ -468,17 +468,17 @@ RemovableDriveManager::RemovableDrivesSt
// Update is called from thread_proc() and from most of the public methods on demand.
void RemovableDriveManager::update()
{
- tbb::mutex::scoped_lock inside_update_lock;
++ std::unique_lock<std::mutex> inside_update_lock(m_inside_update_mutex, std::defer_lock);
#ifdef _WIN32
// All wake up calls up to now are now consumed when the drive enumeration starts.
m_wakeup = false;
#endif // _WIN32
- if (inside_update_lock.try_acquire(m_inside_update_mutex)) {
-+ if (m_inside_update_mutex.try_lock()) {
++ if (inside_update_lock.try_lock()) {
// Got the lock without waiting. That means, the update was not running.
// Run the update.
std::vector<DriveData> current_drives = this->search_for_removable_drives();
// Post update events.
- tbb::mutex::scoped_lock lock(m_drives_mutex);
-+ std::lock_guard<std::mutex> lock(m_drives_mutex);
++ std::scoped_lock<std::mutex> lock(m_drives_mutex);
std::sort(current_drives.begin(), current_drives.end());
if (current_drives != m_current_drives) {
assert(m_callback_evt_handler);
-@@ -489,8 +488,9 @@ void RemovableDriveManager::update()
+@@ -489,7 +489,7 @@ void RemovableDriveManager::update()
} else {
// Acquiring the m_iniside_update lock failed, therefore another update is running.
// Just block until the other instance of update() finishes.
- inside_update_lock.acquire(m_inside_update_mutex);
-+ m_inside_update_mutex.lock();
++ inside_update_lock.lock();
}
-+ m_inside_update_mutex.unlock();
}
- #ifndef REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp
index 20528804bf..ed5955f1fd 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp
@@ -1,19 +1,16 @@
$NetBSD$
-Migrate from deprecated tbb::mutex to std::mutex.
+Migrate away from features deprecated in tbb 2021.3.
+Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
--- src/slic3r/GUI/RemovableDriveManager.hpp.orig 2021-07-16 10:14:03.000000000 +0000
+++ src/slic3r/GUI/RemovableDriveManager.hpp
-@@ -1,11 +1,11 @@
- #ifndef slic3r_GUI_RemovableDriveManager_hpp_
- #define slic3r_GUI_RemovableDriveManager_hpp_
-
-+#include <mutex>
- #include <vector>
+@@ -5,7 +5,7 @@
#include <string>
#include <boost/thread.hpp>
-#include <tbb/mutex.h>
++#include <mutex>
#include <condition_variable>
// Custom wxWidget events
Home |
Main Index |
Thread Index |
Old Index