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

SCM Repository

[smlnj] Diff of /sml/trunk/system/Basis/Implementation/Sockets/unix-details.sml
ViewVC logotype

Diff of /sml/trunk/system/Basis/Implementation/Sockets/unix-details.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3581, Thu Mar 31 16:25:08 2011 UTC revision 3582, Fri Apr 8 16:38:51 2011 UTC
# Line 7  Line 7 
7   * Author: Matthias Blume (blume@tti-c.org)   * Author: Matthias Blume (blume@tti-c.org)
8   *)   *)
9  structure OpsysDetails : sig  structure OpsysDetails : sig
10    
11      val mkIODesc : int -> PreOS.IO.iodesc      val mkIODesc : int -> PreOS.IO.iodesc
12      val wrapNB_o : ('a -> 'b) -> ('a -> 'b option)      val wrapNB_o : ('a -> 'b) -> ('a -> 'b option)
13      val wrapNB_b : ('a -> unit) -> ('a -> bool)      val wrapNB_b : ('a -> unit) -> ('a -> bool)
14    
15  end = struct  end = struct
16    
17      val mkIODesc = PreOS.IO.IODesc      val mkIODesc = PreOS.IO.IODesc
# Line 17  Line 19 
19      (* The following is essentially lifted from the CML implementation's      (* The following is essentially lifted from the CML implementation's
20       * handling of non-blocking socket I/O.  I am not sure whether       * handling of non-blocking socket I/O.  I am not sure whether
21       * conflating EINPROGRESS, EAGAIN, and EWOULDBLOCK is exactly       * conflating EINPROGRESS, EAGAIN, and EWOULDBLOCK is exactly
22       * the right thing, though... *)    * the right thing, though...
23      val blockErrors =    *)
24          case Posix.Error.syserror "wouldblock" of      val blockErrors = (case Posix.Error.syserror "wouldblock"
25              NONE => [Posix.Error.again, Posix.Error.inprogress]             of NONE => [Posix.Error.again, Posix.Error.inprogress]
26            | SOME e => [e, Posix.Error.again, Posix.Error.inprogress]            | SOME e => [e, Posix.Error.again, Posix.Error.inprogress]
27              (* end case *))
28    
29      fun blockErr (OSImp.SysErr(_, SOME err)) =      fun blockErr (OSImp.SysErr(_, SOME err)) =
30          List.exists (fn err' => err = err') blockErrors          List.exists (fn err' => err = err') blockErrors
# Line 32  Line 35 
35    
36      fun wrapNB_b f x = (f x; true)      fun wrapNB_b f x = (f x; true)
37          handle ex => if blockErr ex then false else raise ex          handle ex => if blockErr ex then false else raise ex
38    
39  end  end

Legend:
Removed from v.3581  
changed lines
  Added in v.3582

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