Signaler::Catch()

Allow interrupt signals from the user to be delivered once more following a previous call to Signaler::Block().

Virtual?

No

 

Class

Signaler

 

Arguments

None

 

Returns

void

 

Notes

Catch() does not replace your signal handler if you have already replaced the Signaler class' handler with one of your own using the ANSI signal(2) function.

For portability reasons, Block() and Catch() use the BSD/ANSI C signal(2) function rather than the POSIX sigaction().

See also

Signaler::Block() Signaler::OnIntr()

Example

int main( int argc, char **argv )
{
    // Block ^C
    printf( "For the next 5 seconds, ^C will be ignored\n" );
    signaler.Block();
    sleep( 5 );

    printf( "Enabling ^C again\n" );
    signaler.Catch();
    for ( ; ; )
        sleep( 60 );
    exit( 0 );
}