[FFmpeg-devel] [PATCH 2/2] avformat/udp: Replace use of pthread_cancel.

Matt Oliver protogonoi at gmail.com
Fri Dec 2 14:24:14 EET 2016


On 2 December 2016 at 22:16, Nicolas George <george at nsup.org> wrote:

> Le duodi 12 frimaire, an CCXXV, Matt Oliver a écrit :
> > ---
> >  configure         |  6 ------
> >  libavformat/udp.c | 48 +++++++++++++++++++-----------------------------
> >  2 files changed, 19 insertions(+), 35 deletions(-)
>
> It looks like there are unrelated changes in this patch.
>

Which changes would those be? all of them are just what is required to
enable threading on non posix systems with pthread_cancel


> Can you explain how it achieves the same result as pthread_cancel()? It
> looks to me it does not.
>

For one currently pthread_cancel is only called for the read thread which
uses the circular_buffer_task_rx function. pthread_cancel is never called
on the transmit thread so the pthread_setcancelstate calls in
circular_buffer_task_tx dont actually do anything. In fact the pthread
cancel state is only enabled in the rx function on either side of the recv
function. This function is already set as nonblocking and so it wont hold
up the thread which can then continue back to the s->close_req check and
terminate cleanly. So functionally I dont think the the pthread_cancel
functionality is even needed as I dont think there is any advantage to
having it and removing it allows the functionality to be enabled on more
systems.


More information about the ffmpeg-devel mailing list