Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish HW05 #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Finish HW05 #26

wants to merge 2 commits into from

Conversation

daohwang
Copy link

@daohwang daohwang commented Feb 2, 2022

  1. 利用shared_mutex对 users 和 has_login 进行保护。
  2. 尽量缩短临界区大小。
  3. 为了避免资源耗尽的问题,修改线程池,一开始只启动固定的若干worker线程执行任务,主线程和worker线程通过生产者消费者模型进行交互。同时使用std::thread::hardware_concurrency()获得当前平台能够同时跑的最大线程数。
  4. 通过使用std::chrono::steady_clock::time_point 替换原始的时间点。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant