[FFmpeg-devel] [PATCH] ffplay: Exit on ctrl-c.

Alexander Strasser eclipse7 at gmx.net
Fri Jan 13 22:59:28 CET 2012


Hi,

Reimar Döffinger wrote:
> On Fri, Jan 13, 2012 at 12:44:14PM +0100, Alexander Strasser wrote:
> > Reimar Döffinger wrote:
> > > On Wed, Jan 11, 2012 at 10:29:32PM +0100, Alexander Strasser wrote:
[...]
> > > >   Just wanted to hear any opinions on the rather theoretical issue,
> > > > so thanks for taking part in the discussion.
> > > 
> > > The only option I see is the approach MPlayer uses:
> > > First just set a flag, but if more signals come in go over to more
> > > desperate means, if necessary even a direct exit().
> > > As for signal-safety: "man 7 signal" list signal-safe functions,
> > > so to avoid exit while staying portable FFmpeg could e.g. send
> > > a SIGKILL to itself.
> > 
> >   that is interesting. I see the `signal' function is in the list
> > of signal-safe functions. So your idea of sending SIGKILL to itself
> > could probably work out.
> 
> You're looking for the wrong function, the 'signal' function is the
> (outdated) way to set a signal handler, the 'kill' function is
> the one for sending a signal.
> It's still in the signal-safe list though.
> I forgot to check if getpid is signal-safe, if not it would need
> yet a bit more mess I think.

  Of course you are right! I always make that error initially and it is
the reason why at least I think that the name of signal() really is a
misnomer :)

  BTW getpid() is also in the list of signal-safe functions.

  Alexander


More information about the ffmpeg-devel mailing list