Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions zh/chapter3-Thread/Introduction-to-Thread.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ thread& operator=(const thread&) = delete;
t2.join();
}

- yield: 当前线程放弃执行,操作系统调度另一线程继续执行。
- yield: 当前线程放弃执行,操作系统调度另一线程继续执行,一般地,系统是会调度另一个相同优先级的线程继续执行,如果当前优先级只有这一个线程,那么yield()没有作用,此时下面的代码输出就还是100

#include <iostream>
#include <chrono>
Expand Down Expand Up @@ -524,4 +524,4 @@ thread&amp; operator=(const thread&amp;) = delete;
执行结果如下:

Hello waiter
Waited 2000 ms
Waited 2000 ms