[FFmpeg-devel] abstractable threading api

Hendrik Leppkes h.leppkes at gmail.com
Mon Dec 16 21:58:31 CET 2013


On Mon, Dec 16, 2013 at 8:03 PM, Roger Pack <rogerdpack2 at gmail.com> wrote:
> As a note,
> Some code, for instance libavformat/udp.c, basically require pthread
> support for some functionality (circular buffer).  I see that there is
> some work to providing that "natively" in the compat/w32* files, but
> it seems to require HAVE_PTHREAD_CANCEL ? Does this mean that the
> compat file isn't complete, or is it somehow not being applied (does
> configure by default use, or does it need a different precompiler
> directive check?

The compat isn't complete, it just contains the functions needed by
avcodec et al, well short of pthread_cancel.
However, providing pthread_cancel with win32 threading api is also
non-trivial, if not impossible to find a "drop in" compat
functionality.

Canceling threads from the outside is a no-no in the win32 API. Most
blocking functions usually have the option to give it a unblock event
that you can trigger to release it, and safely shut down the thread
from within, however as you can imagine thats not something that ports
well over different APIs.

The best course of action in this case would probably be to find a way
to re-write this worker thread without pthread_cancel, other solutions
seem rather ugly.

- Hendrik


More information about the ffmpeg-devel mailing list