[FFmpeg-devel] Network IO in FFmpeg (was: abstractable threading api)
george at nsup.org
Thu Apr 10 16:48:25 CEST 2014
L'octidi 18 germinal, an CCXXII, Roger Pack a écrit :
> I did notice that at least these people:
> Basically added a call to select in their code, to avoid having to
> cancel the thread. FWIW :)
That is almost exactly the code as it was before pthread_cancel() was used.
This ugly because the cancellation is passed through a shared flag that is
not integrated into the select() call and therefore must be polled at
regular interval. That means a long latency to actually cancel the thread,
and useless wake-ups.
The wake-ups are bad for battery life on embedded devices. The long latency
can cause actual problems if the application wants to stop a socket and then
start it again on the same port: if the thread is not cancelled yet, it will
fail due to the port being still in use. With regular polling, the race
condition is very likely to trigger.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: Digital signature
More information about the ffmpeg-devel