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 #20

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

finish hw05 #20

wants to merge 1 commit into from

Conversation

yanmulin
Copy link

作业要求1:把这些函数变成多线程安全的

共享的数据结构
users 使用读写锁保护,do_register写入,do_logindo_queryuser读取
has_login 使用互斥量保护,do_login写入

作业要求2:把这个登录计时器改成基于 chrono 的

has_login的值类型改为std::chrono::time_point,使用std::chrono::duration_cast将时间段转换成秒数

作业要求3:如何让这个线程保持在后台执行不要退出?

使用std::async创建异步任务,保存返回的future。在全局的ThreadPool析构时等待所有异步任务完成才返回。

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