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

fix(mgb/core): fix allocate_task_block_unsafe in thread_impl_1.h

GitOrigin-RevId: 21b92fafc5c96a26f8298f6be83da71072814a92
上级 fa1ca0ea
...@@ -365,14 +365,16 @@ namespace mgb { ...@@ -365,14 +365,16 @@ namespace mgb {
if (!m_free_task_block.empty()) { if (!m_free_task_block.empty()) {
ret = std::move(m_free_task_block.back()); ret = std::move(m_free_task_block.back());
m_free_task_block.pop_back(); m_free_task_block.pop_back();
break;
} else if (m_block_quota > 0) { } else if (m_block_quota > 0) {
ret = std::make_unique<TaskBlock>(); ret = std::make_unique<TaskBlock>();
m_block_quota--; m_block_quota--;
break;
} else { } else {
m_cv.wait(m_mutex); m_cv.wait(m_mutex);
continue; continue;
} }
} while (false); } while (true);
ret->first_tid = m_new_block_first_tid; ret->first_tid = m_new_block_first_tid;
m_new_block_first_tid += BLOCK_SIZE; m_new_block_first_tid += BLOCK_SIZE;
ret->prev = prev; ret->prev = prev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册