| 168 | } |
| 169 | |
| 170 | static 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 | |
| 192 | static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, |
| 193 | pthread_mutex_t *mutex) |
no test coverage detected