提交 6dfd5a4c 编写于 作者: M Megvii Engine Team

fix(win7): workaround for hang when progress exit on win7+32bit

GitOrigin-RevId: b49b0b230e6367eea1bc5b0c061915352409fcb3
上级 ba1508e3
......@@ -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<CompNodeRecorderImpl*>(self)->free_device(ptr);
}
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册