Skip to content

finish hw05 - #20

Open
yanmulin wants to merge 1 commit into
parallel101:mainfrom
yanmulin:main
Open

finish hw05#20
yanmulin wants to merge 1 commit into
parallel101:mainfrom
yanmulin:main

Conversation

@yanmulin

Copy link
Copy Markdown

作业要求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