cmdutils: wrap exit explicitly

Some C runtime implementations deadlock when calling threading functions
on the atexit() handler.

Use a simpler wrapper similar to av_log to call the cleanup function
before exit.

Bug-Id: 523
This commit is contained in:
Luca Barbato
2013-07-07 01:52:51 +02:00
parent 21732063a3
commit 636ced8e1d
4 changed files with 70 additions and 45 deletions

View File

@@ -44,6 +44,16 @@ extern AVFormatContext *avformat_opts;
extern struct SwsContext *sws_opts;
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
/**
* Register a program-specific cleanup routine.
*/
void register_exit(void (*cb)(int ret));
/**
* Wraps exit with a program-specific cleanup routine.
*/
void exit_program(int ret);
/**
* Initialize the cmdutils option system, in particular
* allocate the *_opts contexts.