GitOrigin-RevId: b49b0b230e
tags/v1.11.0
| @@ -620,6 +620,16 @@ class CpuCompNode::CompNodeRecorderImpl final : public CompNodeBaseImpl { | |||||
| public: | public: | ||||
| static void static_free_device(ImplBase* self, void* ptr) { | 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<CompNodeRecorderImpl*>(self)->free_device(ptr); | static_cast<CompNodeRecorderImpl*>(self)->free_device(ptr); | ||||
| } | } | ||||
| @@ -112,6 +112,16 @@ SCQueueSynchronizer::SCQueueSynchronizer(size_t max_spin) { | |||||
| } | } | ||||
| SCQueueSynchronizer::~SCQueueSynchronizer() noexcept { | 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) | if (!m_worker_started) | ||||
| return; | return; | ||||
| if (!m_wait_finish_called) { | if (!m_wait_finish_called) { | ||||