线程是并发 不是并行的
线程创建方式的好多种方式
1.thread ● 函数
thread
t1(fun
,1);
● lamda 函数
thread
t2([](){},2);
● 类对象
Solution s
;
thread
t3(s
,3);
thread
t4(ref(s
),4);
thread
t5(move(s
),5);
thread
t6(Solution(),6);
2.async as
join 和 detach
unique_lock 和 lock_guard
sleep for 和wait
condition_variable
转载请注明原文地址:https://ipadbbs.8miu.com/read-52659.html