[英]can I run same thread for multiple times?
我有這樣的代碼:
while(1) {
if(request == ACCEPT)
pthread_create(&t1, NULL, test_thread, NULL);
}
和test_thread代碼就像
void *test_thread(void * arg)
{
//never ending function
}
這個工作正常,沒有任何問題。 但是我的問題是,如果我這樣跑,有什么問題嗎?
您可以使用相同的線程過程創建多個線程。 您唯一需要擔心的是共享數據(全局/靜態變量等)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.