From 55ed91c8565a3c562d2982e1cd5e66df06c6c190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 19 Jul 2012 19:08:31 +0200 Subject: [PATCH] threads: fix a potential race spotted by helgrind. --- libavcodec/pthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 7f2ea09a74..597aeba91f 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -975,9 +975,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f) avctx->get_buffer == avcodec_default_get_buffer) { err = avctx->get_buffer(avctx, f); } else { + pthread_mutex_lock(&p->progress_mutex); p->requested_frame = f; p->state = STATE_GET_BUFFER; - pthread_mutex_lock(&p->progress_mutex); pthread_cond_broadcast(&p->progress_cond); while (p->state != STATE_SETTING_UP)