從在pthread_join()手冊頁:我是否必須pthread_join創建每個線程?
When a joinable thread terminates, its memory resources (thread descriptor and stack) are not deallocated until thread performs pthread_join on it. Therefore, pthread_join must be called once for each joinable thread created to avoid memory leaks.
這是否意味着我需要加入每個線程創建,以防止泄漏?但加入阻止呼叫者。
請解釋。
您還可以使用pthread_attr_setdetachstate創建帶有PTHREAD_CREATE_DETACHED屬性的線程 – Hasturkun 2009-06-30 16:42:18