PreviousUpNext

15.3.390  src/lib/src/lib/thread-kit/src/core-thread-kit/run-at.api

## run-at.api
#
# This API is 'include'-ed by:
#     src/lib/src/lib/thread-kit/src/glue/thread-scheduler-control.api
#
# Note/forget mailslots, mailqueues and imps
# for initialization and termination.
#
# Compare to:
#     src/lib/std/src/nj/run-at--premicrothread.api

# Compiled by:
#     src/lib/std/standard.lib


api Run_At {
    #
    When = COMPILER_STARTUP             # Initialization of a program that is being run under RunTHREADKIT::do_it.
         | APP_STARTUP                  # Initialization of a stand-alone program that was generated by spawn_to_disk.
         | THREADKIT_SHUTDOWN           # Normal program exit of a threadkit program running under RunTHREADKIT::do_it.
         | APP_SHUTDOWN                 # Normal program exit of a stand-alone threadkit program.
         ;                              #
                                        # The run_at times are somewhat different than the run_at__premicrothread times.                # run_at__premicrothread        src/lib/std/src/nj/run-at--premicrothread.pkg
                                        #
                                        # Note that the clean-up routines run while threadkit is still active.
                                        # It may also be useful for an application to register clean-up routines
                                        # with run_at__premicrothread (SPAWN_TO_DISK actions are the most useful).


    when_to_string: When -> String;     # Maps COMPILER_STARTUP -> "COMPILER_STARTUP" etc.

    note_startup_or_shutdown_action
        :
        (String, List(When), (When -> Void))
        ->
        Null_Or ((List(When), (When -> Void)));
        #
        # Add the named action.
        # This returns the previous definition, or NULL. 

    forget_startup_or_shutdown_action
        :
        String
        ->
        Null_Or ((List(When), (When -> Void)));
        #
        # Remove and return the named action;
        # Return NULL if it is not found. 

    exception NO_SUCH_ACTION;

    note_mailqueue:   (String, mailqueue::Mailqueue(X)) -> Void;
    forget_mailqueue:  String -> Void;

    note_mailslot:    (String, mailslot::Mailslot(X)) -> Void;
    forget_mailslot:   String -> Void;

    note_imp
        :
        { name:        String,                  # Used as arg to forget_imp, also for human display.
          #
          at_startup:  Void -> Void,            # To be called at startup, typically starts up thread.
          at_shutdown: Void -> Void             # To be called at shutdown, may re-inialize globals or such.
        }
        ->
        Void;

    forget_imp:     String -> Void;             # Undo effect of a call to 'note_imp':

    forget_all_mailslots_mailqueues_and_imps:       Void -> Void;
};


## COPYRIGHT (c) 1996 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext