after

Gamma: Version 4.0
Prev |  | Next

# `after`

`after` -- performs an action after a period of time.

## Syntax

    after (seconds, action...)

## Arguments

`seconds`

  A number of seconds, which may be fractional.

`action`

  One or more statements to be executed. This argument is evaluated, so literal statements must be quoted.

## Returns

An integer timer number which may be used as the argument to `cancel`.

## Description

This function specifies an action to be performed after a given period of time in seconds has elapsed. The number of `seconds` may be specified to arbitrary precision, but will be limited in fact by the timer resolution of the operating system. In most cases this is practically limited to 20 milliseconds (0.05 seconds).

The timer functions `after`, `every` and `at` all cause an action to occur at the specified time, regardless of what is happening at that time, except if the timer expires during garbage collection. In this case, the timer will be serviced as soon as the garbage collection finishes.

For Gamma to notice a timer, you must make a call to `next_event`.

## Example

        Gamma> after(30, #princ("Time's up!\n"));
        1
        Gamma> next_event();

        (30 seconds pass)

        Time's up!
        nil
        Gamma>

See the Starting Programs section of the Common Functions for Any Program chapter (Tutorial Two), or the GTK: Recording Data or Photon: Recording Data sections of the History Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

## See Also

`at`, `every`, `cancel`, `_timers_` in Predefined Symbosl

Prev | Home | Next
Time, Date, and Timers | Up | `at`

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