PreviousUpNext

15.4.1223  src/lib/std/src/threadkit/posix/winix-io.pkg

## winix-io.pkg

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



###              "They are ill discoverers that
###               think there is no land, when
###               they can see nothing but sea."
###
###                          -- Francis Bacon



stipulate
    package iom =  io_now_possible_mailop;                                      # io_now_possible_mailop        is from   src/lib/src/lib/thread-kit/src/core-thread-kit/io-now-possible-mailop.pkg
    package wnx =  winix__premicrothread;                                       # winix__premicrothread         is from   src/lib/std/winix--premicrothread.pkg
    package wio =  winix__premicrothread::io;                                   # winix_io__premicrothread      is from   src/lib/std/src/posix/winix-io--premicrothread.pkg
    package wty =  winix_types;                                                 # winix_types                   is from   src/lib/std/src/posix/winix-types.pkg
herein

    package   winix_io
    : (weak)  Winix_Io                                                          # Winix_Io                      is from   src/lib/src/lib/thread-kit/src/winix/winix-io.api
    {
        Iod      =  wio::Iod;
        Iod_Kind == wty::Iod_Kind;

        hash           =  wio::hash;
        compare        =  wio::compare;
        iod_to_iodkind =  wio::iod_to_iodkind;


        Ioplea =  wio::Ioplea;
        Ioplea_Result  =  wio::Ioplea_Result;

        exception BAD_WAIT_REQUEST = wio::BAD_WAIT_REQUEST;


        # The next two provide Mythryl-world access to the
        # wait-for-some-file-descriptor-to-wake-up functionality
        # which at the C level is provided on BSD by select()
        # and on SysV by poll():
        #
        stipulate
            #
            include package   threadkit;                                        # threadkit                     is from   src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg

            fun timeout''  duration
                =
                timeout_in'  duration
                    ==>
                    {. []; };

            fun io_now_possible_on'  pd
                =
                iom::io_now_possible_on'  pd
                    ==>
                    (\\ info =  [ info ]);

        herein

            fun wait_for_io_opportunity_mailop [pd] =>  io_now_possible_on' pd;
                wait_for_io_opportunity_mailop _    =>  raise exception DIE "iom::winix::wait_for_io_opportunity_mailop not fully implemented"; # XXX BUGGO FIXME
            end;

            fun wait_for_io_opportunity ([pd], NULL)  =>  block_until_mailop_fires  (io_now_possible_on'  pd);
                wait_for_io_opportunity ([pd], THE t) =>  do_one_mailop [timeout'' t, io_now_possible_on' pd];
                wait_for_io_opportunity _             =>  raise exception DIE "iom::winix::poll not fully implemented";                         # XXX BUGGO FIXME
            end;
        end;
    };
end;

## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext