PreviousUpNext

15.3.478  src/lib/std/src/hostthread/template-hostthread.api

## template-hostthread.api
#
# Skeleton code for a persistent server hostthread.
# The intention is to simplify construction of
# new server hostthreads via clone-and-mutate.

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


stipulate
    package hth =  hostthread;                                                  # hostthread                    is from   src/lib/std/src/hostthread.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/std/src/hostthread/template-hostthread.pkg

    api Template_Hostthread {
        #
        is_running: Void -> Bool;                                               # Returns TRUE iff the server hostthread is running.
        #
        start:      String -> Bool;                                             # 'String' will be logged as the client requesting startup.
        #                                                                       # Returns TRUE if it started the server hostthread, FALSE if server hostthread was already running.

        Do_Stop = { who:   String,                                              # 'who' will be logged as the client requesting shutdown.
                    reply: Void -> Void
                  };
        stop:     Do_Stop -> Void;

        Do_Echo = { what:  String,                                              # 'what' will be passed to 'reply'.
                    reply: String -> Void
                  };
        echo:  Do_Echo -> Void;
    };
end;

## Code by Jeff Prothero: Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext