[問題] pthread 停止問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
GCC
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
pthread
問題(Question):
是這樣的
我目前程式 main 會處理大部份的事情
但因某種需求要特別處理
所以我多開一條 thread 來做
我使用 linux pthread
pthread_create function 來建一條 thread
因為這 thread 裡有 while(1)
我希望當這thread 有某個情況能停止掉這thread
所以我該如何停止住thread 才是對的呢?
google 一下是該在這個thread 裡面使用 pthread_exit(0)??
那如果要再重啟同樣的thread 是要呼叫一次pthread_create??
抱歉 我是程式新手
剛測試一下是OK的
但想了解正確的做法
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 219.70.202.53
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1429645565.A.4B7.html
→
04/23 20:56, , 1F
04/23 20:56, 1F
→
04/24 14:07, , 2F
04/24 14:07, 2F
推
04/29 14:12, , 3F
04/29 14:12, 3F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章