PreviousUpNext

15.3.484  src/lib/std/src/io/io-startup-and-shutdown.api

## io-startup-and-shutdown.api

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



# This module keeps track of open I/O streams
# and handles the proper cleaning of them.
#
# It is a modified version of the monothread library package
#
#     src/lib/std/src/io/io-startup-and-shutdown--premicrothread.pkg
#
# Unlike the monothread version, we only do cleanup at
# shutdown/exit time:  We do not try to support the
# persistence of threadkit streams across invocations
# of run_threadkit::run_threadkit).
#
# Also, we only require a single clean-up function, which
# flushes the standard streams and closes all others.
#
# These operations should only be called while threadkit
# is running, since they use synchronization primitives.
#
# NOTE: There is currently a problem with removing the
# cleaners for streams that get dropped by the application,
# but the system limit on open files will limit this.


stipulate
    package hok =  run_at;                                                      # run_at        is from   src/lib/src/lib/thread-kit/src/core-thread-kit/run-at.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/std/src/io/io-startup-and-shutdown.pkg
    # 
    api Io_Startup_And_Shutdown {
        #
        Tag;

         std_stream_hook:  Ref( Void -> Void );
            #
            # This function is defined in winix_text_file_for_os_g__premicrothread
            # and is called during startup.
            #
            # It is used to rebuild the standard streams.

         note_stream_startup_and_shutdown_actions:  (Void -> Void) -> Tag;

         change_stream_startup_and_shutdown_actions:  (Tag, (Void -> Void)) -> Void;

         drop_stream_startup_and_shutdown_actions:  Tag -> Void;


         # Link the master IO cleaner fn
         # into the list of cleanup hooks:
         #
         io_cleaner
            :
            ( String,
              List( hok::When ),
              (     hok::When -> Void)
            );

    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext