MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / pthread_cond_timedwait

Function pthread_cond_timedwait

compat/os2threads.h:170–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170static av_always_inline int pthread_cond_timedwait(pthread_cond_t *cond,
171 pthread_mutex_t *mutex,
172 const struct timespec *abstime)
173{
174 int64_t abs_milli = abstime->tv_sec * 1000LL + abstime->tv_nsec / 1000000;
175 ULONG t = av_clip64(abs_milli - av_gettime() / 1000, 0, ULONG_MAX);
176
177 __atomic_increment(&cond->wait_count);
178
179 pthread_mutex_unlock(mutex);
180
181 APIRET ret = DosWaitEventSem(cond->event_sem, t);
182
183 __atomic_decrement(&cond->wait_count);
184
185 DosPostEventSem(cond->ack_sem);
186
187 pthread_mutex_lock(mutex);
188
189 return (ret == ERROR_TIMEOUT) ? ETIMEDOUT : 0;
190}
191
192static av_always_inline int pthread_cond_wait(pthread_cond_t *cond,
193 pthread_mutex_t *mutex)

Callers 3

udp_readFunction · 0.50
sch_waitFunction · 0.50

Calls 3

av_gettimeFunction · 0.85
pthread_mutex_unlockFunction · 0.70
pthread_mutex_lockFunction · 0.70

Tested by

no test coverage detected