pthread: Fix deadlock during thread initialization
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Thu, 10 Oct 2013 15:05:40 +0000 (11:05 -0400)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Sun, 13 Oct 2013 09:50:00 +0000 (05:50 -0400)
commiteb90a2091ffb94d8c29aaa5ff50f4192520254fc
tree86a3e267527f39fca087c8c51242c2acaef933a2
parentc9ef6b09326a24010bf86d6b0d19cfa42df4d546
pthread: Fix deadlock during thread initialization

Sometimes, if pthread_create() failed, then pthread_cond_wait() could
accidentally be called in the worker threads after the uninit function
had already called pthread_cond_broadcast(), leading to a deadlock.

Don't call pthread_cond_wait() if c->done is set.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavcodec/pthread.c
libavfilter/pthread.c