Repository navigation
修复 lab5b benchmark 中的 condition variable 和 mutex 用法 - #3
Merged
Merged
Conversation
Capture submitted task IDs by value, keep condition-variable locks under RAII, and await coroutine waits. Restore the notify-all workload so it performs the same loop and group progression as the other benchmark variants.
Owner
|
感谢修复!这几处修改解决了 benchmark 中实际存在的问题:
已提取本 PR 的线程池和 STL 条件变量函数做隔离验证: 已合入 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
i,避免任务运行时读到已经变化的循环变量。mutex.unlock();这里的std::unique_lock会负责解锁。lock guard,并对cv.wait(...)使用co_await,确保等待完成后再继续执行。notify_all补上循环计算和gid更新,使它与另外两种实现做相同的工作。