Skip to content

Conversation

@caicaiking
Copy link

1 性能优化 避免不必要的拷贝, std::move 移动字符串
2 根据提供的MTQueue 实现了对应的Threadpool
3 使用shared mutex 实现多读少写的场景。

Copy link
Contributor

@archibate archibate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • login, register 等函数变成多线程安全的 - 10/10 分
  • login 的登录计时器改成基于 chrono 的 - 5/5 分
  • 能利用 shared_mutex 区分读和写 - 10/10 分
  • lock_guard 系列符合 RAII 思想 - 5/5 分
  • 让 ThreadPool::create 创建的线程保持后台运行不要退出 - 15/15 分
  • 等待 tpool 中所有线程都结束后再退出 - 5/5 分
  • 能够在 PR 描述中用自己的话解释 20/25 分
  • 代码格式规范、能够跨平台 5/5 分
  • 有自己独特的创新点 19/20 分

一下就看懂了老师偷偷塞一个MTQueue.h的用意!的确这里直接push 262144个线程会导致奔溃,所以可以像TBB那样,一个线程多个任务是最好的方案。线程池实现的不错!视为独特的创新点!

@archibate archibate mentioned this pull request Jan 17, 2022
@Leo-AO-99 Leo-AO-99 mentioned this pull request Jan 30, 2023
This pull request was closed.
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.

2 participants