PreviousUpNext

15.3.382  src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit-startup-and-shutdown-hooks.api

## threadkit-startup-and-shutdown-hooks.api

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

# 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.

api Threadkit_Startup_And_Shutdown_Hooks {
    #
    When = STARTUP | APP_STARTUP | THREADKIT_SHUTDOWN | SHUTDOWN;
        #
        # The threadkit clean-up times are somewhat different than the Lib7
        # times.
        #
        #       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.
        #
        #       SHUTDOWN                Normal program exit of a stand-alone threadkit program.
        #
        # 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 Lib7 (SPAWN_TO_DISK actions are the most useful).


    at_all:  List( When );
        #
        # At all times 

    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-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext