Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对线程基础有疑问。如果我启动一个新线程T1,主线程必须等待T1加入或无需等待即可继续执行?
如果必须等待,我可以让主线程和新线程异步运行吗?
如果您不调用join()两个线程同时执行。默认情况下,线程异步运行。join()阻塞调用线程,直到线程终止。
join()
我想添加以使线程同步执行,并提供并发控制机制。
可以探索一下POSIX 线程编程