void ff_thread_await_progress(ThreadFrame *f, int n, int field)

{

    PerThreadContext *p;

    atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;



    if (!progress ||

        atomic_load_explicit(&progress[field], memory_order_acquire) >= n)

        return;



    p = f->owner[field]->internal->thread_ctx;



    pthread_mutex_lock(&p->progress_mutex);

    if (f->owner[field]->debug&FF_DEBUG_THREADS)

        av_log(f->owner[field], AV_LOG_DEBUG,

               "thread awaiting %d field %d from %p\n", n, field, progress);

    while (atomic_load_explicit(&progress[field], memory_order_relaxed) < n)

        pthread_cond_wait(&p->progress_cond, &p->progress_mutex);

    pthread_mutex_unlock(&p->progress_mutex);

}

void ff_thread_await_progress(ThreadFrame *f, int n, int field)

{

    PerThreadContext *p;

    atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;



    if (!progress ||

        atomic_load_explicit(&progress[field], memory_order_acquire) >= n)

        return;



    p = f->owner[field]->internal->thread_ctx;



    pthread_mutex_lock(&p->progress_mutex);

    if (f->owner[field]->debug&FF_DEBUG_THREADS)

        av_log(f->owner[field], AV_LOG_DEBUG,

               "thread awaiting %d field %d from %p\n", n, field, progress);

    while (atomic_load_explicit(&progress[field], memory_order_relaxed) < n)

        pthread_cond_wait(&p->progress_cond, &p->progress_mutex);

    pthread_mutex_unlock(&p->progress_mutex);

}

    if (f->owner[field]->debug&FF_DEBUG_THREADS)     if (f->owner[field]->debug&FF_DEBUG_THREADS)
void FUNC_0(ThreadFrame *VAR_0, int VAR_1, int VAR_2)

{

    PerThreadContext *p;

    atomic_int *progress = VAR_0->progress ? (atomic_int*)VAR_0->progress->data : NULL;



    if (!progress ||

        atomic_load_explicit(&progress[VAR_2], memory_order_acquire) >= VAR_1)

        return;



    p = VAR_0->owner[VAR_2]->internal->thread_ctx;



    pthread_mutex_lock(&p->progress_mutex);

    if (VAR_0->owner[VAR_2]->debug&FF_DEBUG_THREADS)

        av_log(VAR_0->owner[VAR_2], AV_LOG_DEBUG,

               "thread awaiting %d VAR_2 %d from %p\VAR_1", VAR_1, VAR_2, progress);

    while (atomic_load_explicit(&progress[VAR_2], memory_order_relaxed) < VAR_1)

        pthread_cond_wait(&p->progress_cond, &p->progress_mutex);

    pthread_mutex_unlock(&p->progress_mutex);

}

void FUNC_0(ThreadFrame *VAR_0, int VAR_1, int VAR_2)
{ PerThreadContext *p; atomic_int *progress = VAR_0->progress ? (atomic_int*)VAR_0->progress->data : NULL; if (!progress ||
atomic_load_explicit(&progress[VAR_2], memory_order_acquire) >= VAR_1)
return; p = VAR_0->owner[VAR_2]->internal->thread_ctx; pthread_mutex_lock(&p->progress_mutex); if (VAR_0->owner[VAR_2]->debug&FF_DEBUG_THREADS)
av_log(VAR_0->owner[VAR_2], AV_LOG_DEBUG,
"thread awaiting %d VAR_2 %d from %p\VAR_1", VAR_1, VAR_2, progress); while (atomic_load_explicit(&progress[VAR_2], memory_order_relaxed) < VAR_1)
pthread_cond_wait(&p->progress_cond, &p->progress_mutex); pthread_mutex_unlock(&p->progress_mutex); }