EPHEMERAL


Motivation

We need the ability to identify procedures that can safely be terminated, because not all extensions can be suspended -- for example, user-defined interrupt handlers. We call such procedures EPHEMERAL.

Definition

An EPHEMERAL procedure is only allowed to call other EPHEMERAL procedures. The base system-provided routines that allocate memory or involve synchronization -- &, NEW, LOCK DO -- are defined as non-EPHEMERAL.

We allow an EPHEMERAL procedure in an UNSAFE module to call non-EPHEMERAL procedures.

Syntax

The keyword PROCEDURE can be preceded by the keyword EPHEMERAL, both in a procedure type or a procedure definition.

Examples

EPHEMERAL PROCEDURE KillMe() =
  BEGIN
    WHILE TRUE DO
      (* infinite loop *)
    END;
  END KillMe;

PROCEDURE CannotKill() =
  VAR NewMemory : REF INTEGER;
  BEGIN
    (* NEW is not EPHEMERAL, so CannotKill cannot be EPHEMERAL *)
    NewMemory = NEW (REF INTEGER);
  END CannotKill;


Other SPIN Modula-3 changes

September 19, 1996

whsieh@cs.washington.edu