Skip to content

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