看板 Programming 關於我們 聯絡資訊
※ [本文轉錄自 C_and_CPP 看板] 作者: littleboypis (littleboypis) 看板: C_and_CPP 標題: [問題] Pthread暫停和恢復功能 時間: Sun Mar 8 16:43:08 2009 Pthread有暫停suspend和resume功能嗎 因為我需要讓Thread在執行到一半時暫停 像是 Work Thread Exec Body { for( i = 1~100 ) { call_action_1(); call_action_2(); call_action_3(); } } Another Thread { pthread_suspend(); if( cond == true ) pthread_resume(); } another thread執行了pthread_suspend work thread就放下執行工作停下 可能停在任意的一行code上, 有可能是action1或者action3 不曉得Linux上的PThread有沒有支援 我查google 和 API好像都沒這兩個功能 不曉得有什麼方式可以達到 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.216.117 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.216.117
falis:使用semaphore如何 220.132.91.110 03/09 12:59