MCPcopy Create free account
hub / github.com/brummer10/guitarix / processWait

Method processWait

trunk/src/headers/ParallelThread.h:215–234  ·  view source on GitHub ↗

wait for the processed data from the thread, in worst case this may fail silent when to much time expires (5 * timeOut time) to avoid Xruns or dead looks.

Source from the content-addressed store, hash-verified

213 // when to much time expires (5 * timeOut time)
214 // to avoid Xruns or dead looks.
215 inline void processWait() noexcept {
216 if (isRunning()) {
217 int maxDuration = 0;
218 while (pWait.load(std::memory_order_acquire)) {
219 pthread_mutex_lock(&pWaitProc);
220 if (pthread_cond_timedwait(&pProcCond, &pWaitProc, getTimeOut()) == ETIMEDOUT) {
221 pthread_mutex_unlock(&pWaitProc);
222 maxDuration +=1;
223 //fprintf(stderr, "%s wait for data %i\n", threadName.c_str(), maxDuration);
224 if (maxDuration > 5) {
225 pWait.store(false, std::memory_order_release);
226 //fprintf(stderr, "%s break processWait\n", threadName.c_str());
227 }
228 } else {
229 pthread_mutex_unlock(&pWaitProc);;
230 }
231 }
232 //fprintf(stderr, "%s processed data %i\n", threadName.c_str(), maxDuration);
233 }
234 }
235
236 // stop the thread (at least on Destruction)
237 void stop() noexcept {

Callers 1

computeMethod · 0.80

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected