Farid Zaripov wrote:
  Below is a listing of the raise() function from MSVC CRT:

abort() has the same effect as exit(3) on Windows? What a mess!

Maybe we should ditch abort() and use TerminateProcess() instead,
with some unique value to let us distinguish our own SIGABRT from
exit(3).

Martin

int __cdecl raise (
        int signum
        )
{
[...]
        /*

        * If the current action is SIG_IGN, just return

        */

        if ( sigact == SIG_IGN )

                return(0);

        /*

        * If the current action is SIG_DFL, take the default action

        */

        if ( sigact == SIG_DFL ) {

                /*

                * The current default action for all of the supported

                * signals is to terminate with an exit code of 3.

                */

                _exit(3);

        }

[...]
}
And also the listing of the abort() : void __cdecl abort (

        void

        )

{

        _PHNDLR sigabrt_act = SIG_DFL;

        if (__abort_behavior & _WRITE_ABORT_MSG)

        {

            /* write the abort message */

            _NMSG_WRITE(_RT_ABORT);

        }

        /* Check if the user installed a handler for SIGABRT.

        * We need to read the user handler atomically in the case

        * another thread is aborting while we change the signal

        * handler.

        */

        sigabrt_act = __get_sigabrt();

        if (sigabrt_act != SIG_DFL)

        {

            raise(SIGABRT);

        }

        /* If there is no user handler for SIGABRT or if the user

        * handler returns, then exit from the program anyway

        */

[...]

        /* If we don't want to call ReportFault, then we call _exit(3), which 
is the

        * same as invoking the default handler for SIGABRT

        */

        _exit(3);

}

Farid.

Reply via email to