pthread: Avoid spurious wakeups
authorBen Jackson <ben@ben.com>
Fri, 18 Oct 2013 14:28:50 +0000 (15:28 +0100)
committerSean McGovern <gseanmcg@gmail.com>
Mon, 21 Oct 2013 16:25:26 +0000 (12:25 -0400)
commit311583e7798237be5cc531d672a9e37f8c729d83
tree81930e2e722a89e2693a43d0cd94fb2075f598ae
parent1a5a6ac01b0ad2cf3d2128372ea41f3c1cfc2d3f
pthread: Avoid spurious wakeups

pthread_wait_cond can wake up unexpectedly (Wikipedia: Spurious_wakeup).

The FF_THREAD_SLICE thread mechanism could spontaneously execute
jobs or allow the caller of avctx->execute to return before all
jobs were complete.

Test both cases to ensure the wakeup is real.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/pthread.c