PreviousUpNext

15.3.493  src/lib/std/src/nj/runtime-signals.api

## signals.api

# Compiled by:
#     src/lib/std/src/standard-core.sublib



# These are the two basic interfaces to the run-time system signals support.
# The interface covers the basic signals operations, plus a small collection
# of standard signals that should be portable to non-UNIX systems.
#
# The original design of this system is discussed in:
#
#     Asynchronous Signals in Standard ML
#     John H Reppy 1990 19p
#     http://mythryl.org/pub/pml/asynchronous-signals-in-standard-ml-reppy-1990-19p.ps 

# This API is implemented in:
#
#     src/lib/std/src/nj/runtime-signals.pkg
#
# it is also 'include'-d in the anonymous api in
#
#     src/lib/std/src/nj/runtime-signals-guts.pkg

api Runtime_Signals {
    #
    eqtype Signal;

    Signal_Action
      = IGNORE
      | DEFAULT
      | HANDLER  (Signal, Int, fate::Fate(Void))  ->  fate::Fate( Void )
      ;

    list_signals:  Void -> List( Signal );
        #
        # List the signals supported by this version 

    signal_name:  Signal -> String;                             # Return the name of a signal.

    get_signal_by_name:  String -> Null_Or( Signal );
        #
        # Return the signal with the corresponding name.
        # Return NULL if no such signal exists.

    set_signal_handler:       (Signal, Signal_Action) -> Signal_Action;
        #
        # Set the handler for a signal, returning the previous action. 

    override_signal_handler:  (Signal, Signal_Action) -> Signal_Action;
        #
        # If a signal is not being ignored, then set the handler.
        #
        # Returns the previous handler:  If IGNORE, then
        # the current handler is still IGNORE.

    get_signal_handler                          # Get the current action for the given signal 
         :
         Signal -> Signal_Action;

    Signal_Mask
      = MASK_ALL
      | MASK  List(Signal)
      ;

    mask_signals:  Signal_Mask -> Void;
        #
        # Mask the specified set of signals.
        #
        # Signals that are not IGNORED
        # will be delivered when unmasked.
        #
        # Calls to mask_signals nest on a
        # per-signal basis.

    unmask_signals:  Signal_Mask -> Void;
        #
        # Unmask the specified signals.  The unmasking of a signal that is
        # not masked has no effect.

    masked:  Void -> Signal_Mask;
        #
        # return the set of masked signals; the value MASK[] means that
        # no signals are masked.

    pause:  Void -> Void;
        #
        # sleep until the next signal; if called when signals are masked,
        # then signals will still be masked when pause returns.

    # These signals should be supported even on non-UNIX platforms. 
    #
    interrupt_signal:           Signal;         # interactive interrupt -- SIGINT
    alarm_signal:               Signal;         # interval timer signal -- SIGALRM
    terminate_signal:           Signal;         # termination           -- SIGTERM.
    #
    heapcleaning_done_signal:   Signal;         # Pseudosignal generated internally by runtime for hypothetical Mythryl app code.               I can find no current use of this. -- 2012-03-20 CrT 

};                                                      # api Signals 



## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext