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

hw05提交 #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

hw05提交 #22

wants to merge 1 commit into from

Conversation

yangyueren
Copy link

  • 使用shared_mutex区分读和写,std::shared_lockstd::shared_mutex是读锁,std::lock_guardstd::shared_mutex是写锁。
  • 借鉴Cpp并发编程中ThreadPool的写法,创建了一个固定线程数量的线程。
  • 为了让tpool中所有线程都结束后再析构tpool,在tpool的析构函数里检查当前任务队列是否为空。

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