一個計時器線程如何創建一個定時器線程函數:timerThreadFunction(的pthread_t的thread_id),並檢查計時的結果在其他功能安全的方式:如何創建在C
// Begin of atomic part -- cause i'm in multithreaded environement
if (timerThreadFunction(thread_id) has not expired) {
// SOME WORK HERE
}
else {
// Timer expired
// some work here
}
// End of atomic part
感謝。
因爲C沒有本地線程庫,所以你必須告訴我們你在什麼平臺上,所以我們可以建議。我也建議您重新提出您的問題以指出該平臺。免得你被平臺的答案轟炸,你不感興趣。 – jer 2011-01-14 21:20:07
LINUX平臺:) – iPadDevloperJr 2011-01-14 21:22:00
@jer:在問題中提到`pthread_t`似乎意味着Pthreads庫。 – caf 2011-01-15 06:25:17