cancel

Gamma: Version 4.0
Prev |  | Next

# `cancel`

`cancel` -- removes a timer from the set of pending timers.

## Syntax

    cancel (timer_number)

## Arguments

`timer_number`

  An integer number returned from a call to `after`, `at` or `every`.

## Returns

The complete timer definition for the canceled timer, or nil if no timer was canceled.

## Description

Removes a timer from the set of pending timers based on its unique timer ID as returned by the function which created the timer. If no timer could be found with the corresponding timer number, nothing happens.

## Example

To set a timer to repeat every 5 seconds, then stop it:

        Gamma> every(5, #princ("hello\n"));
        1
        Gamma> cancel(1);
        [945884155 683256506 5 ((princ "hello\n")) 1]
        Gamma>

See the Automatically Change SP Value section of the PID Emulator chapter, or the Common: Starting and Stopping the Cascade TextLogger section of the Log Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

## See Also

`_timers_` in Predefined Symbols

Prev | Home | Next
`block_timers`, `unblock_timers` | Up | `clock`, `nanoclock`

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