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/compiler/PervEnv/Unsafe/poll.sml
ViewVC logotype

View of /sml/trunk/src/compiler/PervEnv/Unsafe/poll.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 114 - (download) (annotate)
Fri Jun 5 19:41:21 1998 UTC (22 years, 2 months ago) by monnier
File size: 889 byte(s)
This commit was generated by cvs2svn to compensate for changes in r113,
which included commits to RCS files with non-trunk default branches.
(* poll.sml
 *
 * COPYRIGHT (c) 1997 Bell Labs, Lucent Technologies.
 *)

structure Poll : POLL = 
  struct
    exception BadPollFreq

    val defaultHandler = fn k => k

    val _ = Assembly.pollHandler := defaultHandler
    val handlerValid = ref false

    val pollEvent = Assembly.pollEvent
    val pollFreq = Assembly.pollFreq

    fun setHandler NONE = (
	  Assembly.pollHandler := defaultHandler;
	  handlerValid := false)
      | setHandler (SOME h) = (
	  Assembly.pollHandler := h;
	  handlerValid := true)

    fun inqHandler () = if !handlerValid then SOME (!Assembly.pollHandler)
			  else NONE

    fun setFreq NONE = pollFreq := 0
      | setFreq (SOME x) = if x <= 0 then raise BadPollFreq
			     else pollFreq := x

    fun inqFreq () = let val x = !pollFreq
		       in
			   if x = 0 then NONE
			   else SOME x
		       end
  end (* structure Poll *)

(*
 * $Log$
 *)

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