当前位置:网站首页>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));
}
边栏推荐
- Electron pit Addon
- URLs and URIs
- When facing the industrial Internet, they even use the ways and methods of consuming the Internet to land and practice the industrial Internet
- SWT / anr problem - anr/je causes SWT
- AS400 API 从零到一的整个历程
- The latest CSDN salary increase technology stack in 2022 overview of APP automated testing
- SWT/ANR问题--ANR/JE引发SWT
- Clickhouse eliminates the gap caused by group by
- How to learn and read code
- [JS] [Nuggets] get people who are not followers
猜你喜欢
Short message sending solution in medical his industry
零基础自学SQL课程 | 窗口函数
求两个线段公共部分的长度
How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?
How to maintain efficient collaboration in remote office and achieve stable growth of projects | community essay solicitation
(翻译)使用眉状文本提高标题点击率
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
Desai wisdom number - other charts (parallel coordinate chart): employment of fresh majors in 2021
[2022] Jiangxi postgraduate mathematical modeling scheme and code
Pytoch -- foundation refers to the north_ II. What high school students can understand [back propagation and gradient descent]
随机推荐
The latest CSDN salary increase technology stack in 2022 overview of APP automated testing
My PMP learning test experience
Rocketqa: cross batch negatives, de noised hard negative sampling and data augmentation
How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?
What are the preferential activities for stock account opening? In addition, is it safe to open a mobile account?
Short message sending solution in medical his industry
Go import self built package
(翻译)实时内联验证更容易让用户犯错的原因
Do you write API documents or code first?
Zero foundation self-study SQL course | window function
Int and bit group turn to each other
Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。
halcon数组的一些使用
Is there any discount for opening an account now? In addition, is it safe to open a mobile account?
SWT/ANR问题--AMS/WMS
[content of content type request header]
我的PMP学习考试心得
FL Studio20.9水果软件高级中文版电音编曲
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
ANR问题的分析与解决思路