線程的執(zhí)行時機 線程在其對象被創(chuàng)建后立即執(zhí)行。 等待線程和分離線程 線程創(chuàng)建后通過調(diào)用thread對象的join()或detach()函數(shù)決定線程是等待還是分離; 不能對沒有執(zhí)行線程的thread對象使用join()或detach(); 使用join()或detach()之前應對thread對象進行 Read More
posted @ 2019-09-27 15:46
二杠一
Views(159)
Comments(0)
Diggs(0)
以上代碼中就包含兩個線程:“主線程”、“t線程”。主線程入口函數(shù)為“main”而t線程入口函數(shù)為“hello”。t.join()保證了主線程會等待t線程及其相關線程。 Read More
posted @ 2019-09-27 11:08
二杠一
Views(218)
Comments(0)
Diggs(0)

浙公網(wǎng)安備 33010602011771號