PreviousUpNext

13.4.71  microthread

The standard library microthread package implements basic thread functionality for multithreaded Mythryl programs. (Mythryl threads are lightweight userspace constructs not to be confused with posix threads, which are uniformly termed “hostthreads” in Mythryl documents.)

The microthread package implements the Microthread api.

The microthread package source code is in src/lib/src/lib/thread-kit/src/core-thread-kit/microthread.pkg. 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  = ...;
    default_microthread : Microthread;
    get_current_microthread : Void -> Microthread;
    get_current_microthread's_name : Void -> String;
    get_current_microthread'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 -> Mailop(Void );
    task_done__mailop : Apptask -> 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};
    default_exception_handler : Ref((Exception -> Void) );
    reset_thread_package : {running:Bool} -> Void;};

Comments and suggestions to: bugs@mythryl.org

PreviousUpNext