討論串[問題] 關於thread釋放記憶體問題
共 2 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者puph (真冷...)時間15年前 (2009/03/05 18:45), 編輯資訊
1
0
0
內容預覽:
大家好 小弟目前在寫一個C code. 需要用到timer timer會由事件處發. 我使用thread來實現timer 每當事件發生就起始一個thread. 我想要計時 5秒 thread一啟動 就先下sleep(5). 等sleep結束 再執行我想要做的事. 做完下pthread_exit()
(還有94個字)

推噓0(0推 0噓 2→)留言2則,0人參與, 最新作者hylkevin (Kevin)時間15年前 (2009/03/05 21:07), 編輯資訊
0
0
0
內容預覽:
線程可用pthread_exit(void *retval)結束. 但是並不會清理資源. 直到你在其他任何線程中呼叫pthread_join(pthread_t thread_id, void** ret);. thread_id是pthread_create時產生. *ret=retval. 或者
首頁
上一頁
1
下一頁
尾頁