当前位置:网站首页>Thread Detach
Thread Detach
2022-07-01 02:20:00 【月上纱窗】
#include <iostream>
#include <chrono>
#include <thread>
void independentThread()
{
std::cout << "Starting concurrent thread.\n";
std::this_thread::sleep_for(std::chrono::seconds(2));
std::cout << "Exiting concurrent thread.\n";
}
void threadCaller()
{
std::cout << "Starting thread caller.\n";
std::thread t(independentThread);
t.detach();
std::this_thread::sleep_for(std::chrono::seconds(1));
std::cout << "Exiting thread caller.\n";
}
int main()
{
threadCaller();
std::this_thread::sleep_for(std::chrono::seconds(5));
}
边栏推荐
- Short video platform development, relying on drawerlayout to achieve side sliding menu effect
- PMP是什么?
- When facing the industrial Internet, they even use the ways and methods of consuming the Internet to land and practice the industrial Internet
- ANR问题的分析与解决思路
- 如何在智汀中實現智能鎖與燈、智能窗簾電機場景聯動?
- Delete duplicate email
- [fundamentals of wireless communication-15]: illustrated mobile communication technology and application development-3-overview of digital communication 2G GSM, CDMA, 3G wdcma/cdma200/td-scdma, 4G LTE
- How do I open an account on my mobile phone? Also, is it safe to open an account online?
- CorelDRAW 2022中文精简64位直装版下载
- SWT / anr problem - storagemanagerservice stuck
猜你喜欢
go导入自建包
(翻译)实时内联验证更容易让用户犯错的原因
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]
Zero foundation self-study SQL course | window function
【JS】【掘金】获取关注了里不在关注者里的人
PMP是什麼?
CentOS installs multiple versions of PHP and switches
机器学习9-通用逼近器径向基函数神经网络,在新观点下审视PDA和SVM
The latest wechat iPad protocol code obtains official account authorization, etc
Pytoch -- foundation refers to the north_ II. What high school students can understand [back propagation and gradient descent]
随机推荐
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]
模板:全局平衡二叉树
Objects and object variables
7-2 punch in reward DP for puzzle a
十大劵商如何开户?还有,在线开户安全么?
LabVIEW计算相机图像传感器分辨率以及镜头焦距
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
Calculate special bonus
How to learn and read code
聚焦绿色低碳,数据中心散热进入“智能冷却”新时代
Some uses of Halcon array
如何在智汀中實現智能鎖與燈、智能窗簾電機場景聯動?
halcon变量窗口的图像变量不显示,重启软件和电脑都没用
手机edge浏览器无法打开三方应用
What is PMP?
项目管理是什么?
SQL语句关联表 如何添加关联表的条件 [需要null值或不需要null值]
Fast understanding of forward proxy and reverse proxy
centos 安装多个版本的php并切换
LabVIEW calculates the camera image sensor resolution and lens focal length