Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/cml/src/Win32/os-io.sml
ViewVC logotype

View of /sml/trunk/src/cml/src/Win32/os-io.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (download) (annotate)
Mon Sep 7 21:09:17 1998 UTC (20 years, 11 months ago) by monnier
File size: 1381 byte(s)
Initial revision
(* os-io.sml
 *
 * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies.
 *
 *)

structure OS_IO : OS_IO =
  struct
    structure IOM = IOManager

    type iodesc = OS.IO.iodesc
    type iodesc_kind = OS.IO.iodesc_kind

    val hash = OS.IO.hash
    val compare = OS.IO.compare
    val kind = OS.IO.kind

    structure Kind = OS.IO.Kind

    type poll_desc = OS.IO.poll_desc
    type poll_info = OS.IO.poll_info

    val pollDesc = OS.IO.pollDesc
    val pollToIODesc = OS.IO.pollToIODesc

    exception Poll = OS.IO.Poll

  (* set polling events; if the polling operation is not appropriate
   * for the underlying I/O device, then the Poll exception is raised.
   *)
    val pollIn  = OS.IO.pollIn
    val pollOut = OS.IO.pollOut
    val pollPri = OS.IO.pollPri

  (* polling functions *)
    local
      fun timeOut t = CML.wrap(CML.timeOutEvt t, fn () => [])
      fun ioEvt pd = CML.wrap(IOM.ioEvt pd, fn info => [info])
    in
    fun pollEvt [pd] = ioEvt pd
      | pollEvt _ = raise Fail "IO.OS.pollEvt not fully implemented"
    fun poll ([pd], NONE) = CML.sync(ioEvt pd)
      | poll ([pd], SOME t) = CML.select[timeOut t, ioEvt pd]
      | poll _ = raise Fail "IO.OS.poll not fully implemented"
    end

  (* check for conditions *)
    val isIn 		= OS.IO.isIn
    val isOut		= OS.IO.isOut
    val isPri		= OS.IO.isPri
    val infoToPollDesc  = OS.IO.infoToPollDesc

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0