当前位置:网站首页>Thread Detach
Thread Detach
2022-07-01 02:23:00 【Upper moon screen】
#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));
}
边栏推荐
- [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?
- [punch in questions] integrated daily 5 questions sharing (phase I)
- Clickhouse 消除由group by产生的间隙
- 零基础自学SQL课程 | 窗口函数
- 修复表中的名字(首字符大写,其他小写)
- Leetcode (524) -- match the longest word in the dictionary by deleting letters
- import tensorflow.contrib.slim as slim报错
- Calculate special bonus
- SWT / anr problem - SWT caused by long execution time of native method
猜你喜欢
(summary I) Halcon Foundation's target finding features + becoming a regular
House change for agricultural products? "Disguised" house purchase subsidy!
项目管理是什么?
Focusing on green and low carbon, data center cooling has entered a new era of "intelligent cooling"
@The difference between configurationproperties and @value
【JS】【掘金】获取关注了里不在关注者里的人
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?
2022年最新csdn涨薪技术栈-app自动化测试概述
Machine learning 9-universal approximator radial basis function neural network, examining PDA and SVM from a new perspective
随机推荐
The whole process of AS400 API from zero to one
Do you write API documents or code first?
How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?
SWT/ANR问题--Dump时间过长导致的SWT
Clickhouse eliminates the gap caused by group by
SWT/ANR问题--Deadlock
修复表中的名字(首字符大写,其他小写)
Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。
【毕业季·进击的技术er】--毕业到工作小结
SWT / anr problem - binder stuck
js中的图片预加载
(summary I) Halcon Foundation's target finding features + becoming a regular
When facing the industrial Internet, they even use the ways and methods of consuming the Internet to land and practice the industrial Internet
What are the preferential activities for stock account opening? In addition, is it safe to open a mobile account?
go导入自建包
The latest wechat iPad protocol code obtains official account authorization, etc
SAP ALV汇总跟导出Excel 汇总数据不一致
How do the top ten securities firms open accounts? Also, is it safe to open an account online?
There is no future to be expected. It is just the last fantasy of a migrant worker before he dies
Leetcode 面试题 17.10. 主要元素