簡體   English   中英

如果我不關心返回值,是否需要pthread_exit?

[英]Do I need pthread_exit if I don't care of return value

如果我不關心我的線程的返回狀態,我需要有一個pthread_exit嗎?

我想知道在我的數據庫pthreads中是否存在與不調用pthread_exit相關的一些細微資源問題。

謝謝。

目的pthread_exit()用於返回任何其他連接的線程的退出代碼。

手冊

   Performing a return from the start function of any thread other than the main
   thread results in an implicit call to pthread_exit(), using the function's
   return value as the thread's exit status.

所以,如果你不使用它沒有任何區別。

您不必調用pthread_exit() 從線程函數返回將同樣有效,並且不會泄漏任何資源(當然,您仍然必須確保您的代碼沒有任何泄漏)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM