
C++
&罗毅
灵机一动即是天机
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++异步编程
std::async和std::future创建后台任务并返回值 一,前言 std::async是一个函数模板,用来启动一个异步任务,启动起来的异步任务会返回一个std::futured对象,这个对象里面有异步任务的返回结果。 int func(){ std::this_thread::sleep_for(std::chrono::seconds(1)); return 0; } int main(){ std::future<int> result = s原创 2020-10-12 02:04:25 · 2176 阅读 · 1 评论 -
C++多线程
多线程 一,线程状态· thread.join() -------------- 阻塞当前线程thread,直到thread执行完成; thread.detach() ----------使得当前线程脱离主线程的控制,该线程的资源由后台进程回收资源; thread.joinable() ---------- 判断线程是否可以join或者detach; 二,线程创建写法 普通函数作为线程参数 可调用对象作为线程参数-----例...原创 2020-10-12 00:29:14 · 623 阅读 · 0 评论 -
C++11 chrono库
#include <iostream> #include <ctime> #include <ratio> #include <chrono> int main () { // template <class num,class den> class ratio; std::ratio<1,3> one_third; std::ratio<2,4> two_fourths; s.原创 2020-10-01 23:16:56 · 163 阅读 · 0 评论 -
C++后端开发常考知识点
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<vector> #include<algorithm> #include<memory> #include<assert.h> #include<climits> #include<mutex>...原创 2019-10-07 23:12:10 · 692 阅读 · 1 评论