MCPcopy Create free account
hub / github.com/clementgallet/libTAS / endThreadedDelay

Method endThreadedDelay

src/library/DeterministicTimer.cpp:243–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243void DeterministicTimer::endThreadedDelay(struct timespec delayTicks)
244{
245 ThreadInfo* thread = ThreadManager::getCurrentThread();
246
247 if (isInsideFrameBoundary()) {
248 thread->addedDelay = {0, 0};
249 thread->fakeExtraTicks = {0, 0};
250 return;
251 }
252
253 if (framecount > thread->startingFrameDelay) {
254 /* We ended the delay after a frame boundary, so we don't add the delay to the timer */
255 thread->addedDelay = {0, 0};
256 thread->fakeExtraTicks = {0, 0};
257 return;
258 }
259
260 thread->addedDelay += delayTicks;
261
262 TimeHolder maxThreadedDelay = {2, 0};
263
264 if (thread->addedDelay > maxThreadedDelay) {
265 LOG(LL_WARN, LCF_TIMESET, "We detected some softlocks, we fake advancing time for thread %d by %u.%09u seconds", thread->real_tid, delayTicks.tv_sec, delayTicks.tv_nsec);
266 thread->fakeExtraTicks += delayTicks;
267 thread->addedDelay = {0, 0};
268 }
269}
270
271void DeterministicTimer::flushDelay()
272{

Callers 1

pthread_cond_timedwaitFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected