pthread地獄 part 2 (232レス)
pthread地獄 part 2 http://mevius.5ch.net/test/read.cgi/unix/1166620307/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
113: 93 [sage] 2008/07/24(木) 09:46:56 複数のワーカースレッドの終了を待つロジックを書いてみた。 /* 全てのワーカースレッドの終了を待つ */ pthread_mutex_lock(&m_end); while (0 != thread_num) { while(NULL == thr_end) { pthread_cond_wait(&c_end, &m_end); } nrc = pthread_join(thr_end, NULL); if (0 == nrc) { fprintf(stdout, "thread %5d is exited...\n", thr_end); --thread_num; thr_end = NULL; }else{ fprintf(stdout, "Error pthread_join() return %d\n", nrc); } pthread_cond_broadcast(&c_end); } pthread_mutex_unlock(&m_end); fprintf(stdout, "ALL thread is exited... thread_num=%d\n", thread_num); http://mevius.5ch.net/test/read.cgi/unix/1166620307/113
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 119 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.016s