⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syscall.sml

📁 这是我们参加06年全国开源软件的竞赛作品
💻 SML
字号:
(* syscall.sml * * COPYRIGHT (c) 1998 Bell Labs, Lucent Technologies. * COPYRIGHT (c) 1996 AT&T Research. * * Some system calls may take a long time to complete and may * be interrupted by timer signals before they complete.  This * module implements mechanisms to protect against this problem. *)structure Syscall : sig    val isIntr : OS.syserror -> bool    val doSyscall : ('a -> 'b) -> 'a -> 'b	(* do a system call, and restart if it is interrupted *)    val doAtomicSyscall : ('a -> 'b) -> 'a -> 'b	(* do a system call with timer signals masked *)  end = struct    structure S = Scheduler    fun isIntr err = false (* TOFIX: this'll break... (err = Posix.Error.intr) *)    fun doAtomicSyscall f x = let	  val _ = S.stopTimer()	  val y = (f x) handle ex => (S.restartTimer(); raise ex)	  in	    S.restartTimer(); y	  end    fun doSyscall f x = let	  fun try 0 = doAtomicSyscall f x	    | try n = ((f x)		handle (ex as OS.SysErr(_, SOME err)) =>		  if isIntr err then try(n-1) else raise ex)	  in	    try 3	  end  end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -