Skip to content

Commit

Permalink
更新基本概念中的 mermaid 图
Browse files Browse the repository at this point in the history
  • Loading branch information
Mq-b committed Aug 3, 2024
1 parent 0b7e481 commit 8743775
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions md/01基本概念.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ graph TD;
subgraph "单核机器的任务切换"
SingleCore[单核机器]
SingleCore --> OS[操作系统调度]
OS --> TaskSwitching[任务切换]
TaskSwitching --> Task1[任务1执行片段]
TaskSwitching --> Task2[任务2执行片段]
TaskSwitching --> Task3[任务3执行片段]
OS --> Task1[任务1执行片段]
Task1 --> OS2[操作系统调度]
OS2 --> Task2[任务2执行片段]
Task2 --> OS3[操作系统调度]
OS3 --> Task3[任务3执行片段]
end
```

## 并发与并行
Expand Down
2 changes: 1 addition & 1 deletion md/04同步操作.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ std::cout << future.get() << '\n'; // 不阻塞,此处获取返回值
std::packaged_task<double(int, int)> task([](int a, int b){
return std::pow(a, b);
});
std::future<double>future = task.get_future();
std::future<double> future = task.get_future();
std::thread t{ std::move(task),10,2 }; // 任务在线程中执行
// todo.. 幻想还有许多耗时的代码
t.join();
Expand Down

0 comments on commit 8743775

Please sign in to comment.