Skip to content

Commit 86e15b2

Browse files
authored
Update mtqueue.hpp
1 parent 73ce6ce commit 86e15b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

slides/thread/mtqueue.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct mt_queue {
9696
// 尝试取数据,如果没有,等待直到时间点,超时返回 nullopt
9797
std::optional<T> try_pop_until(std::chrono::steady_clock::time_point timeout) {
9898
std::unique_lock lock(m_mutex);
99-
if (!m_cv_empty.wait_for(lock, timeout, [&] { return !m_queue.empty(); }))
99+
if (!m_cv_empty.wait_until(lock, timeout, [&] { return !m_queue.empty(); }))
100100
return std::nullopt;
101101
T value = std::move(m_queue.back());
102102
m_queue.pop_back();

0 commit comments

Comments
 (0)