Implemented new API function burn_set_signal_handling(), libburner uses it

This commit is contained in:
2006-10-03 16:37:08 +00:00
parent b3bea43074
commit 3b16ef699f
11 changed files with 349 additions and 35 deletions

View File

@ -3,7 +3,7 @@
A signal handler which cleans up an application and exits.
Provided under GPL license within cdrskin and under BSD license elsewise.
Provided under GPL license within GPL projects, BSD license elsewise.
*/
/*
@ -65,7 +65,7 @@ static int Cleanup_handler_exit(int exit_value, int signum, int flag)
if(cleanup_perform_app_handler_first)
if(cleanup_app_handler!=NULL) {
ret= (*cleanup_app_handler)(cleanup_app_handle,signum,0);
if(ret==2)
if(ret==2 || ret==-2)
return(2);
}
if(cleanup_exiting) {
@ -77,11 +77,14 @@ static int Cleanup_handler_exit(int exit_value, int signum, int flag)
}
cleanup_exiting= 1;
if(cleanup_msg[0]!=0)
fprintf(stderr,"%s\n",cleanup_msg);
fprintf(stderr,"\n%s\n",cleanup_msg);
alarm(0);
if(!cleanup_perform_app_handler_first)
if(cleanup_app_handler!=NULL)
(*cleanup_app_handler)(cleanup_app_handle,signum,0);
if(cleanup_app_handler!=NULL) {
ret= (*cleanup_app_handler)(cleanup_app_handle,signum,0);
if(ret==2 || ret==-2)
return(2);
}
exit(exit_value);
}
@ -115,8 +118,12 @@ int Cleanup_set_handlers(void *handle, Cleanup_app_handler_T handler, int flag)
cleanup_msg[0]= 0;
cleanup_app_handle= handle;
cleanup_app_handler= handler;
/* <<< make cleanup_exiting thread safe to get rid of this */
if(flag&4)
cleanup_perform_app_handler_first= 1;
if(flag&1)
sig_handler= SIG_DFL;
else if(flag&2)