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 d4ca67bae9
commit ae4158ada8
11 changed files with 349 additions and 35 deletions

View File

@ -186,6 +186,7 @@ or
#ifdef Cdrskin_new_api_tesT
/* put macros under test caveat here */
#define Cdrskin_libburn_has_cleanup_handleR 1
#endif
@ -273,7 +274,12 @@ or
#include <libburn/libburn.h>
#ifdef Cdrskin_libburn_has_cleanup_handleR
#define Cleanup_set_handlers burn_set_signal_handling
#define Cleanup_app_handler_T burn_abort_handler_t
#else
#include "cleanup.h"
#endif
/** The size of a string buffer for pathnames and similar texts */
@ -2652,11 +2658,10 @@ int Cdrskin_abort_handler(struct CdrskiN *skin, int signum, int flag)
if(getpid()!=skin->control_pid) {
if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(fprintf(stderr,
"cdrskin_debug: ABORT : Thread rejected: pid=%d, signum=%d\n",
getpid(),signum));
return(2); /* do only process the control thread */
"\ncdrskin_debug: ABORT : [%d] Thread rejected: pid=%d, signum=%d\n",
skin->control_pid,getpid(),signum));
return(-2); /* do only process the control thread */
}
if(skin->preskin->abort_handler==3)
Cleanup_set_handlers(NULL,NULL,2); /* ignore all signals */
else if(skin->preskin->abort_handler==4)

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.10.02.103418"
#define Cdrskin_timestamP "2006.10.03.162719"

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)

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.
*/
#ifndef Cleanup_includeD
@ -13,7 +13,7 @@
/** Layout of an application provided cleanup function using an application
provided handle as first argument and the signal number as second
argument. The third argument is a flag bit field with no defined bits yet.
If the handler returns 2 then it has delegated exit() to some other
If the handler returns 2 or -2 then it has delegated exit() to some other
instance and the Cleanup handler shall return rather than exit.
*/
typedef int (*Cleanup_app_handler_T)(void *, int, int);

View File

@ -7,6 +7,7 @@
debug_opts=
def_opts=
libvers="-DCdrskin_libburn_0_2_3"
cleanup_src_or_obj="cdrskin/cleanup.c"
libdax_msgs_o="libburn/libdax_msgs.o"
do_strip=0
static_opts=
@ -24,10 +25,12 @@ do
then
libvers="-DCdrskin_libburn_cvs_A60220_tS"
libdax_msgs_o="libburn/message.o"
cleanup_src_or_obj="cdrskin/cleanup.c"
elif test "$i" = "-libburn_0_2_2"
then
libvers="-DCdrskin_libburn_0_2_2"
libdax_msgs_o="libburn/message.o"
cleanup_src_or_obj="cdrskin/cleanup.c"
elif test "$i" = "-libburn_0_2_3"
then
libvers="-DCdrskin_libburn_0_2_3"
@ -35,9 +38,11 @@ do
elif test "$i" = "-newapi" -o "$i" = "-experimental"
then
def_opts="$def_opts -DCdrskin_new_api_tesT"
cleanup_src_or_obj="libburn/cleanup.o"
elif test "$i" = "-oldfashioned"
then
def_opts="$def_opts -DCdrskin_oldfashioned_api_usE"
cleanup_src_or_obj="cdrskin/cleanup.c"
elif test "$i" = "-do_not_compile_cdrskin"
then
compile_cdrskin=0
@ -85,7 +90,7 @@ echo "Build timestamp : $timestamp"
if test "$compile_cdrskin"
then
echo "compiling program cdrskin/cdrskin.c $static_opts $debug_opts $libvers $def_opts"
echo "compiling program cdrskin/cdrskin.c $static_opts $debug_opts $libvers $def_opts $cleanup_src_or_obj"
cc $warn_opts -I. $static_opts $debug_opts $libvers $def_opts \
-DCdrskin_build_timestamP='"'"$timestamp"'"' \
\
@ -93,7 +98,8 @@ then
\
cdrskin/cdrskin.c \
$fifo_source \
cdrskin/cleanup.c \
\
$cleanup_src_or_obj \
\
libburn/async.o \
libburn/debug.o \