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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/cml/src/Unix/os-io.sml
ViewVC logotype

Annotation of /sml/trunk/src/cml/src/Unix/os-io.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 2 (* os-io.sml
2 :     *
3 :     * COPYRIGHT (c) 1995 AT&T Bell Laboratories.
4 :     *
5 :     *)
6 :    
7 :     structure OS_IO : OS_IO =
8 :     struct
9 :     structure IOM = IOManager
10 :    
11 :     type iodesc = OS.IO.iodesc
12 :     type iodesc_kind = OS.IO.iodesc_kind
13 :    
14 :     val hash = OS.IO.hash
15 :     val compare = OS.IO.compare
16 :     val kind = OS.IO.kind
17 :    
18 :     structure Kind = OS.IO.Kind
19 :    
20 :     type poll_desc = OS.IO.poll_desc
21 :     type poll_info = OS.IO.poll_info
22 :    
23 :     val pollDesc = OS.IO.pollDesc
24 :     val pollToIODesc = OS.IO.pollToIODesc
25 :    
26 :     exception Poll = OS.IO.Poll
27 :    
28 :     (* set polling events; if the polling operation is not appropriate
29 :     * for the underlying I/O device, then the Poll exception is raised.
30 :     *)
31 :     val pollIn = OS.IO.pollIn
32 :     val pollOut = OS.IO.pollOut
33 :     val pollPri = OS.IO.pollPri
34 :    
35 :     (* polling functions *)
36 :     local
37 :     fun timeOut t = CML.wrap(CML.timeOutEvt t, fn () => [])
38 :     fun ioEvt pd = CML.wrap(IOM.ioEvt pd, fn info => [info])
39 :     in
40 :     fun pollEvt [pd] = ioEvt pd
41 :     | pollEvt _ = raise Fail "IO.OS.pollEvt not fully implemented"
42 :     fun poll ([pd], NONE) = CML.sync(ioEvt pd)
43 :     | poll ([pd], SOME t) = CML.select[timeOut t, ioEvt pd]
44 :     | poll _ = raise Fail "IO.OS.poll not fully implemented"
45 :     end
46 :    
47 :     (* check for conditions *)
48 :     val isIn = OS.IO.isIn
49 :     val isOut = OS.IO.isOut
50 :     val isPri = OS.IO.isPri
51 :     val infoToPollDesc = OS.IO.infoToPollDesc
52 :    
53 :     end

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