14.4.38  Io_Wait_Hostthread

The standard library Io_Wait_Hostthread api defines the interface for a dedicated hostthread which essentially sits in a loop doing C select() on the currently interesting set of file descriptors, pipe descriptors and socket descriptors. The primary purpose is to offload blocking I/O from the main threadkit hostthread, allowing it to run full speed. (A secondary purpose is to generate a timeslicing clock for threadkit via the select() timeout.)

The Io_Wait_Hostthread api is implemented by the io_wait_hostthread package.

The Io_Wait_Hostthread api source code is in src/lib/std/src/hostthread/io-wait-hostthread.api. The above information is manually maintained and may contain errors.

api {
    is_running : Void -> Bool;
    start_server_hostthread_if_not_running : String -> Void;
    Do_Stop  = {per_who:String, reply:Void -> Void};
    stop_server_hostthread_if_running : Do_Stop -> Void;
    Do_Echo  = {reply:String -> Void, what:String};
    echo : Do_Echo -> Void;
    Do_Note_Iod_Reader  = {io_descriptor:Int, read_fn:Int -> Void};
    note_iod_reader : Do_Note_Iod_Reader -> Void;
    drop_iod_reader : Int -> Void;
    Do_Note_Iod_Writer  = {io_descriptor:Int, write_fn:Int -> Void};
    note_iod_writer : Do_Note_Iod_Writer -> Void;
    drop_iod_writer : Int -> Void;
    Do_Note_Iod_Oobder  = {io_descriptor:Int, oobd_fn:Int -> Void};
    note_iod_oobder : Do_Note_Iod_Oobder -> Void;
    drop_iod_oobder : Int -> Void;
    get_timeout_interval : Void -> time::Time;
    set_timeout_interval : time::Time -> Void;
    is_doing_useful_work : Void -> Bool;};

Comments and suggestions to: