1. Manipulate waiting count in pthread_cond_wait()
2. Use builtin atomic functions to manipulate waiting count
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
For useage in other places besides lavc. Needed after commit
90f9a5830b5d332de7ebb1ab45589f1870cbd65d
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>