PreviousUpNext

14.4.96  Threadkit

The standard library Threadkit api is the base of the multithreaded-programming api hierarchy.

The Threadkit api is implemented by the threadkit package.

The Threadkit api source code is in src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.api.

The above information is manually maintained and may contain errors.

api {
    exception THREAD_SCHEDULER_NOT_RUNNING;
    package state : api {
                        State 
                          = ALIVE
                          | FAILURE
                          | FAILURE_DUE_TO_UNCAUGHT_EXCEPTION
                          | SUCCESS;
                    };;
    Apptask ;
    Microthread ;
    get_current_thread : Void -> Microthread;
    get_current_thread's_name : Void -> String;
    get_current_thread's_id : Void -> Int;
    get_task's_id : Apptask -> Int;
    get_task's_name : Apptask -> String;
    get_task's_state : Apptask -> state::State;
    get_task's_alive_threads_count : Apptask -> Int;
    same_task : (Apptask , Apptask) -> Bool;
    compare_task : (Apptask , Apptask) -> Order;
    same_thread : (Microthread , Microthread) -> Bool;
    compare_thread : (Microthread , Microthread) -> Order;
    hash_thread : Microthread -> Unt;
    kill_thread : {success:Bool,  thread:Microthread} -> Void;
    kill_task : {success:Bool,  task:Apptask} -> Void;
    get_thread's_id : Microthread -> Int;
    get_thread's_id_as_string : Microthread -> String;
    get_thread's_name : Microthread -> String;
    get_thread's_state : Microthread -> state::State;
    get_thread's_task : Microthread -> Apptask;
    get_exception_that_killed_thread : Microthread -> Null_Or(Exception );
    get_exception_that_killed_task : Apptask -> Null_Or(Exception );
    Make_Thread_Args 
      = THREAD_NAME String | THREAD_TASK Apptask;
    make_thread' : List(Make_Thread_Args )
                   -> (X -> Void) -> X -> Microthread;
    make_thread : String -> (Void -> Void) -> Microthread;
    make_task : String
                -> List(((String , (Void -> Void))) ) -> Apptask;
    thread_exit : {success:Bool} -> X;
    thread_done__mailop : Microthread -> ?.internal_threadkit_types::Mailop(Void );
    task_done__mailop : Apptask -> ?.internal_threadkit_types::Mailop(Void );
    yield : Void -> Void;
    run_thread__xu : Microthread -> (X -> Void) -> X -> Void;
    make_per_thread_property : (Void -> X)
                               -> {clear:Void -> Void,  get:Void -> X, 
                                   peek:Void -> Null_Or(X ),  set:X -> Void};
    make_boolean_per_thread_property : Void -> {get:Void -> Bool,  set:Bool -> Void};
    Mailslot X;
    make_mailslot : Void -> Mailslot(X );
    same_mailslot : (Mailslot(X ) , Mailslot(X )) -> Bool;
    put_in_mailslot : (Mailslot(X ) , X) -> Void;
    take_from_mailslot : Mailslot(X ) -> X;
    put_in_mailslot' : (Mailslot(X ) , X)
                       -> ?.internal_threadkit_types::Mailop(Void );
    take_from_mailslot' : Mailslot(X ) -> ?.internal_threadkit_types::Mailop(X );
    nonblocking_put_in_mailslot : (Mailslot(X ) , X) -> Bool;
    nonblocking_take_from_mailslot : Mailslot(X ) -> Null_Or(X );
    Maildrop X;
    exception MAY_NOT_FILL_ALREADY_FULL_MAILDROP;
    make_empty_maildrop : Void -> Maildrop(X );
    make_maildrop : X -> Maildrop(X );
    put_in_maildrop : (Maildrop(X ) , X) -> Void;
    take_from_maildrop : Maildrop(X ) -> X;
    take_from_maildrop' : Maildrop(X ) -> ?.internal_threadkit_types::Mailop(X );
    nonblocking_take_from_maildrop : Maildrop(X ) -> Null_Or(X );
    peek_in_maildrop : Maildrop(X ) -> X;
    peek_in_maildrop' : Maildrop(X ) -> ?.internal_threadkit_types::Mailop(X );
    nonblocking_peek_in_maildrop : Maildrop(X ) -> Null_Or(X );
    maildrop_swap : (Maildrop(X ) , X) -> X;
    maildrop_swap' : (Maildrop(X ) , X)
                     -> ?.internal_threadkit_types::Mailop(X );
    same_maildrop : (Maildrop(X ) , Maildrop(X )) -> Bool;
    Oneshot_Maildrop X;
    exception MAY_NOT_FILL_ALREADY_FULL_ONESHOT_MAILDROP;
    make_oneshot_maildrop : Void -> Oneshot_Maildrop(X );
    put_in_oneshot : (Oneshot_Maildrop(X ) , X) -> Void;
    take_from_oneshot : Oneshot_Maildrop(X ) -> X;
    take_from_oneshot' : Oneshot_Maildrop(X )
                         -> ?.internal_threadkit_types::Mailop(X );
    nonblocking_take_from_oneshot : Oneshot_Maildrop(X ) -> Null_Or(X );
    same_oneshot_maildrop : (Oneshot_Maildrop(X ) , Oneshot_Maildrop(X )) -> Bool;
    Mailqueue X;
    make_mailqueue : Void -> Mailqueue(X );
    same_mailqueue : (Mailqueue(X ) , Mailqueue(X )) -> Bool;
    put_in_mailqueue : (Mailqueue(X ) , X) -> Void;
    take_from_mailqueue : Mailqueue(X ) -> X;
    take_from_mailqueue' : Mailqueue(X ) -> ?.internal_threadkit_types::Mailop(X );
    nonblocking_take_from_mailqueue : Mailqueue(X ) -> Null_Or(X );
    mailqueue_length : Mailqueue(X ) -> Int;
    mailqueue_to_string : Mailqueue(X ) -> String;
    Mailcaster X;
    Readqueue X;
    make_mailcaster : Void -> Mailcaster(X );
    make_readqueue : Mailcaster(X ) -> Readqueue(X );
    clone_readqueue : Readqueue(X ) -> Readqueue(X );
    receive : Readqueue(X ) -> X;
    receive' : Readqueue(X ) -> ?.internal_threadkit_types::Mailop(X );
    transmit : (Mailcaster(X ) , X) -> Void;
    Mailop X;
    do_one_mailop : List(Mailop(X ) ) -> X;
    ==> : (Mailop(X ) , (X -> Y)) -> Mailop(Y );
    dynamic_mailop : (Void -> Mailop(X )) -> Mailop(X );
    dynamic_mailop_with_nack : (Mailop(Void ) -> Mailop(X )) -> Mailop(X );
    never' : Mailop(X );
    always' : X -> Mailop(X );
    make_compound_mailop : (Mailop(X ) , (X -> Y)) -> Mailop(Y );
    make_exception_handling_mailop : (Mailop(X ) , (Exception -> X)) -> Mailop(X );
    cat_mailops : List(Mailop(X ) ) -> Mailop(X );
    block_until_mailop_fires : Mailop(X ) -> X;
    state_to_string : microthread::state::State -> String;
    get_or_make_current_cleanup_task : Void -> ?.internal_threadkit_types::Apptask;
    note_thread_cleanup_action : (Void -> Void) -> Void;
    note_task_cleanup_action : (Void -> Void) -> Void;
    timeout_in' : Float -> ?.Mailop(Void );
    timeout_at' : time::Time -> ?.Mailop(Void );
    sleep_for : Float -> Void;
    sleep_until : time::Time -> Void;
    start_up_thread_scheduler : (Void -> Void) -> Int;
    start_up_thread_scheduler' : time::Time -> (Void -> Void) -> Int;
    run_under_thread_scheduler : (Void -> X) -> Void;
    shut_down_thread_scheduler : Int -> X;
    spawn_to_disk : (String , ((String , List(String )) -> Int)
                     , Null_Or(time::Time ))
                    -> Void;
    When 
      = APP_SHUTDOWN
      | APP_STARTUP
      | COMPILER_STARTUP
      | THREADKIT_SHUTDOWN;
    when_to_string : When -> String;
    note_startup_or_shutdown_action : (String , List(When ) , (When -> Void))
                                      -> Null_Or(((List(When ) , (When -> Void))) );
    forget_startup_or_shutdown_action : String
                                        -> Null_Or(((List(When ) , (When -> Void))) );
    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 : {at_shutdown:Void -> Void, 
                at_startup:Void -> Void,  name:String}
               -> Void;
    forget_imp : String -> Void;
    forget_all_mailslots_mailqueues_and_imps : Void -> Void;
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext