diff --git a/src/core/impl/comp_node/cpu/comp_node.cpp b/src/core/impl/comp_node/cpu/comp_node.cpp index ce26dcfb..cdee4a58 100644 --- a/src/core/impl/comp_node/cpu/comp_node.cpp +++ b/src/core/impl/comp_node/cpu/comp_node.cpp @@ -620,6 +620,16 @@ class CpuCompNode::CompNodeRecorderImpl final : public CompNodeBaseImpl { public: static void static_free_device(ImplBase* self, void* ptr) { +//! FIXME: Windows 7 + 32bit have shared_ptr dtor issue when progress exit +//! as a workaround, skip any task at atexit stage. +#if MGB_HAVE_THREAD +#if defined(WIN32) && defined(__i386__) + if (SCQueueSynchronizer::is_into_atexit) { + mgb_log_warn("windows 32bit issue happened!!, resource recovery by OS!!"); + return; + } +#endif +#endif static_cast(self)->free_device(ptr); } diff --git a/src/core/impl/utils/thread.cpp b/src/core/impl/utils/thread.cpp index c025cd61..5e5b249c 100644 --- a/src/core/impl/utils/thread.cpp +++ b/src/core/impl/utils/thread.cpp @@ -112,6 +112,16 @@ SCQueueSynchronizer::SCQueueSynchronizer(size_t max_spin) { } SCQueueSynchronizer::~SCQueueSynchronizer() noexcept { +#if defined(WIN32) && defined(__i386__) + if (SCQueueSynchronizer::is_into_atexit) { + mgb_log_warn("windows 32bit issue happened!!, resource recovery by OS!!"); + m_wait_finish_called = true; + //! need detach, if not, thread dtor will crash, OS will recovery thread + //! resource by call std::terminate. + m_worker_thread.detach(); + return; + } +#endif if (!m_worker_started) return; if (!m_wait_finish_called) {