Follow-up of a47446574eb3f831907248dc841eb6f7684bbdb3 - Disable tbb::task_scheduler_observer in TBBLocalesSetter destructor.

The base class wasn't disabling observing when tbb::task_scheduler_observer was destructed, which leads to undefined behavior.
This commit is contained in:
Lukáš Hejl 2022-06-02 11:51:43 +02:00
parent 345ee7cf28
commit 6bdaf0eaec

View File

@ -1501,7 +1501,7 @@ class TBBLocalesSetter : public tbb::task_scheduler_observer
{ {
public: public:
TBBLocalesSetter() { this->observe(true); } TBBLocalesSetter() { this->observe(true); }
~TBBLocalesSetter() override = default; ~TBBLocalesSetter() override { this->observe(false); };
void on_scheduler_entry(bool is_worker) override void on_scheduler_entry(bool is_worker) override
{ {
@ -1513,7 +1513,7 @@ public:
} }
private: private:
tbb::enumerable_thread_specific<bool, tbb::cache_aligned_allocator<bool>, tbb::ets_key_usage_type::ets_key_per_instance> m_is_locales_sets; tbb::enumerable_thread_specific<bool, tbb::cache_aligned_allocator<bool>, tbb::ets_key_usage_type::ets_key_per_instance> m_is_locales_sets{false};
}; };
// Process all layers of all objects (non-sequential mode) with a parallel pipeline: // Process all layers of all objects (non-sequential mode) with a parallel pipeline: