当前位置:网站首页>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));
}边栏推荐
- 522. Longest special sequence II
- Objects and object variables
- Fix names in the table (first character uppercase, other lowercase)
- Electron pit Addon
- Mathematical knowledge: 01 sequence satisfying conditions - find combinatorial number
- With one-stop insight into industry hot spots, the new function "traffic market" of feigua data station B is launched!
- Upstream and downstream in software development
- (translation) reasons why real-time inline verification is easier for users to make mistakes
- How do I open an account on my mobile phone? Also, is it safe to open an account online?
- How to realize the scene linkage of intelligent lock, lamp and intelligent curtain motor in zhiting?
猜你喜欢

int和位数组互转
![Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]](/img/6e/279dbb7a8d7a5ecd240de464c5b8b2.png)
Pytorch —— 基础指北_贰 高中生都能看懂的[反向传播和梯度下降]

Sitge joined the opengauss open source community to jointly promote the ecological development of the database industry

如何在智汀中實現智能鎖與燈、智能窗簾電機場景聯動?

CentOS installs multiple versions of PHP and switches

求两个线段公共部分的长度

The image variables in the Halcon variable window are not displayed, and it is useless to restart the software and the computer

Ernie-gram, 显式、完备的 n-gram 掩码语言模型,实现了显式的 n-gram 语义单元知识建模。

PMP是什么?

QML控件类型:ToolTip
随机推荐
How do I open an account on my mobile phone? Also, is it safe to open an account online?
My PMP learning test experience
AS400 大廠面試
Pytorch - - Basic Reference North Deux élèves du secondaire peuvent comprendre [Rétropropagation et Gradient descendant]
Fix names in the table (first character uppercase, other lowercase)
[punch in questions] integrated daily 5 questions sharing (phase I)
Electron pit Addon
Selenium classic interview question - multi window switching solution
機器學習10-信念貝葉斯分類器
Batch import of Excel data in applet
QT web development - VIDEO - Notes
删除重复的电子邮箱
[JS adds attributes to elements: setAttribute; classlist.remove; classlist.add;]
(翻译)使用眉状文本提高标题点击率
I want to know how to open a stock account? Is it safe to open an account online?
【做题打卡】集成每日5题分享(第一期)
【2022年】江西省研究生数学建模方案、代码
【JS】【掘金】获取关注了里不在关注者里的人
Template: globally balanced binary tree
端口号和进程号的区别?