block_signal, unblock_signal

Gamma: Version 4.0
Prev |  | Next

# `block_signal`, `unblock_signal`

`block_signal`, `unblock_signal` -- delimit signal blocking.

## Syntax

    block_signal (signo)
    unblock_signal (signo)

## Arguments

`signo`

  The integer signal number as defined by the operating system. Symbols such as `SIGINT` are defined to provide an operating-system independent method for specifying this number. (see `signal`)

## Returns

`t`

## Description

`block_signal` causes a particular signal to be blocked until a call to `unblock_signal` is made. If the signal actually occurred while it was blocked, it will occur immediately when `unblock_signal` is called. Multiple occurrences of the signal while it was blocked will cause the signal to be reported multiple times when `unblock_signal` is called on most operating systems. Code that blocks signals should be surrounded by a call to `unwind_protect`.

## Example

        Gamma> block_signal(14);
        t
        Gamma> kill(getpid(),14);
        t
        Gamma> unblock_signal(14);
        Alarm clock

        Gamma> block_signal (SIGINT);
        t
        Gamma> critical_function();
        <function return>
        Gamma> unblock_signal (SIGINT);
        t

See the Linux or QNX section of the Abstracted Functions chapter of the Cogent Tools Demo and Tutorials book for an example of these functions used in context.

## See Also

`block_timers`, `unblock_timers`

Prev | Home | Next
`atexit` | Up | `errno`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.