| 62 | } |
| 63 | |
| 64 | void ff_thread_progress_await(const ThreadProgress *pro_c, int n) |
| 65 | { |
| 66 | /* Casting const away here is safe, because we only read from progress |
| 67 | * and will leave pro_c in the same state upon leaving the function |
| 68 | * as it had at the beginning. */ |
| 69 | ThreadProgress *pro = (ThreadProgress*)pro_c; |
| 70 | |
| 71 | if (atomic_load_explicit(&pro->progress, memory_order_acquire) >= n) |
| 72 | return; |
| 73 | |
| 74 | ff_mutex_lock(&pro->progress_mutex); |
| 75 | while (atomic_load_explicit(&pro->progress, memory_order_relaxed) < n) |
| 76 | ff_cond_wait(&pro->progress_cond, &pro->progress_mutex); |
| 77 | ff_mutex_unlock(&pro->progress_mutex); |
| 78 | } |
no test coverage detected