Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.2

# Signaler::Block()

Cause interrupt signals from the user to be ignored until a subsequent call to `Signaler::Catch()`.

Virtual? | No |
Class | `Signaler` |
Arguments | None |
Returns | `void` |

## Notes

`Block()` does not actually block the signals, but causes the process to ignore them.

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

## See also

- `Signaler::Catch()`

- `Signaler::OnIntr()`

## Example

    #include <unistd.h>  // for sleep()
    #include <stdhdrs.h>
    #include <strbuf.h>
    #include <signaler.h>

    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 );
    }

Your search for returned results