07 2021 档案

摘要:前要先加锁pthread_cond_wait内部会解锁,然后等待条件变量被其它线程激活 pthread_cond_wait被激活后会再自动加锁 激活线程: 加锁(和等待线程用同一个锁) pthread_cond_signal发送信号 解锁 线程便会调用pthread_cond_wait阻塞自己,但是 阅读全文
posted @ 2021-07-22 16:23 MoonXu 阅读(319) 评论(0) 推荐(0) 编辑
摘要:netsh winsock reset 打开虚拟机前选择net模式 重启电脑 阅读全文
posted @ 2021-07-21 11:46 MoonXu 阅读(880) 评论(0) 推荐(0) 编辑
摘要:future对象通过以下方式获得 async promise::get_future packaged_task::get_future 阅读全文
posted @ 2021-07-20 17:37 MoonXu 阅读(38) 评论(0) 推荐(0) 编辑
摘要:类似于std::function,它会把结果自动到转移到future对象 int countdown (int from, int to) { for (int i=from; i!=to; --i) { std::cout << i << '\n'; std::this_thread::sleep 阅读全文
posted @ 2021-07-20 17:29 MoonXu 阅读(58) 评论(0) 推荐(0) 编辑
摘要:std::function<int(int,int)> foo,bar;用函数类型初始化模板参数 阅读全文
posted @ 2021-07-20 17:24 MoonXu 阅读(38) 评论(0) 推荐(0) 编辑
摘要:double my_divide (double x, double y) {return x/y;} int main () { using namespace std::placeholders; // adds visibility of _1, _2, _3,... // binding f 阅读全文
posted @ 2021-07-20 17:10 MoonXu 阅读(61) 评论(0) 推荐(0) 编辑
摘要:Returns an rvalue reference to arg if arg is not an lvalue reference. If arg is an lvalue reference, the function returns arg without modifying its ty 阅读全文
posted @ 2021-07-20 17:02 MoonXu 阅读(38) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示