Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-10-30 05:10:55


Hi,

I have some problem with gcc that came with cygwin. I remember it was
reported before either. error_handling_test hangs during run. Here what I
was able to minimize it to:

#include <signal.h>
#include <setjmp.h>
static sigjmp_buf& jump_buffer()
{
    static sigjmp_buf s_sigjmp_buf;
    return s_sigjmp_buf;
}
extern "C" {
static void execution_monitor_signal_handler( int sig ) {
    siglongjmp( jump_buffer(), sig );
}
}

int main()
{
    struct sigaction action_for_all_signals;
    action_for_all_signals.sa_flags = 0;
    action_for_all_signals.sa_handler = &execution_monitor_signal_handler;
    sigemptyset( &action_for_all_signals.sa_mask );

    sigaction( SIGFPE , &action_for_all_signals, NULL );
    sigaction( SIGSEGV, &action_for_all_signals, NULL );
    sigaction( SIGABRT, &action_for_all_signals, NULL );

    volatile int sigtype = sigsetjmp( jump_buffer(), 1 );
    if( sigtype == 0 ) {
        int a = 0;
        a = 1 / a;
    }
    else {
        throw 1;
    }

    return 0;
}

This code snippet hangs. Any leads? Note how it's behavior differ depending
on which sigaction statement you comment.

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk