replace sched_yield with select

sched_yield is not implemented in Linux at least with glibc 2.19 and
select has been choosen as it is async signal safe.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Rework gl_capture mulithreading sync design

There was a race condition where you could drain the buffer from pipe
thread while a gl thread could capture and put a new packet into the buffer
We now make sure that all ongoing capture, if any, finish before returning
from the stop function.

Also there was also doubts about the update color messages. packetbuffer_t
is thread safe but packet_t maybe not. So instead if an update color is requested
we just flag it with an atomic bitwise op and let only the gl thread manipulate
the packet object.

Finally, we issue warning in case of tearing and stuterring detection.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>