PreviousUpNext

15.3.518  src/lib/std/src/pthread/template-pthread.api

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

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


stipulate
    package pth =  pthread;                                                     # pthread                       is from   src/lib/std/src/pthread.pkg
herein

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

    api Template_Pthread {
        #
        is_running: Void -> Bool;                                               # Returns TRUE iff the server pthread is running.
        #
        start:      String -> Bool;                                             # 'String' will be logged as the client requesting startup.
        #                                                                       # Returns TRUE if it started the server pthread, FALSE if server pthread 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-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext