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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

hw05 #19

wants to merge 5 commits into from

Conversation

chuckbruno
Copy link

@chuckbruno chuckbruno commented Jan 17, 2022

1、时间的话用duration_cast可以两个时间点转换成秒,从而知道多上时间登录过;
2、do_register函数是写函数,所以用std::unique_lock;
3、do_login函数读取数据的时候为读函数用的是std::shared_lock;而在后面有用往里面写时间,用得是std::unique_lock;
4、do_queryuser函数写读函数,所以用std::shared_lock即可;
5、让thread后台不退出,则需要加上join()函数即可,也可以写在析构函数里,这样符合RAII思想,但是我没那样做;
另外,我想开始的时候就给threads,reserver一个值,提高速度,但是如代码所示,报错,不知为何;还有就是不知是不是rand()函数的问题,我这里测试满屏幕都是zhangxinxi没别的名字了,很怪。
对了,之所以换成英文字母是我的编译器编译中文的时候报错,不得不为之。

屏幕截图 2022-01-17 224246

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.

None yet

1 participant