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 /cml/trunk/cml-lib/old-cml.sml
ViewVC logotype

Annotation of /cml/trunk/cml-lib/old-cml.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (view) (download)
Original Path: sml/trunk/src/cml/cml-lib/old-cml.sml

1 : monnier 2 (* old-cml.sml
2 :     *
3 :     * COPYRIGHT (c) 1990 by John H. Reppy. See COPYRIGHT file for details.
4 :     *
5 :     * This is essentially the 0.9.8 version of the core CML interface. The only
6 :     * thing missing is poll and the low-level I/O synchronization.
7 :     *)
8 :    
9 :     structure OldCML : OLD_CML =
10 :     struct
11 :    
12 :     structure NewCML = CML
13 :    
14 :     val version = let
15 :     val (major, minor, rev) = (case (#version_id CML.version)
16 :     of (a::b::c::_) => (a, b, c)
17 :     | [a, b] => (a, b, 0)
18 :     | [a] => (a, 0, 0)
19 :     (* end case *))
20 :     in
21 :     {major = major, minor = minor, rev = rev, date = #date CML.version}
22 :     end
23 :     val versionName = CML.banner
24 :    
25 :     (** events **)
26 :     type 'a event = 'a CML.event
27 :    
28 :     val sync = CML.sync
29 :     val select = CML.select
30 :    
31 :     val choose = CML.choose
32 :    
33 :     val guard = CML.guard
34 :    
35 :     val wrap = CML.wrap
36 :     val wrapHandler = CML.wrapHandler
37 :    
38 :     fun wrapAbort (evt, abortAct) = CML.withNack (fn abortEvt => let
39 :     fun abortAct' () = (sync abortEvt; abortAct())
40 :     in
41 :     CML.spawn abortAct'; evt
42 :     end
43 :    
44 :     val always = CML.always
45 :     val ALWAYS = always()
46 :    
47 :     (** threads **)
48 :     type thread_id = CML.thread_id
49 :    
50 :     val spawn = CML.spawn
51 :    
52 :     val yield = CML.yield
53 :     val exit = CML.exit
54 :    
55 :     val getTid = CML.getTid
56 :     val sameThread = CML.sameTid
57 :     val tidLessThan (tid1, tid2) = (case CML.compareTid(tid1, tid2)
58 :     of LESS => true
59 :     | _ => false
60 :     (* end case *))
61 :     val tidToString = CML.tidToString
62 :    
63 :     val threadWait = CML.joinEvt
64 :    
65 :     (** condition variables **)
66 :     type 'a cond_var = 'a SyncVar.ivar
67 :    
68 :     val condVar = SyncVar.iVar
69 :    
70 :     val writeVar = SyncVar.iPut
71 :     exception WriteTwice = SyncVar.Put
72 :    
73 :     val readVar = SyncVar.iGet
74 :     val readVarEvt = SyncVar.iGetEvt
75 :    
76 :     (** channels **)
77 :     type 'a chan = 'a CML.chan
78 :    
79 :     val channel = CML.channel
80 :    
81 :     val send = CML.send
82 :     fun sendc ch msg = CML.send(ch, msg)
83 :     val accept = CML.recv
84 :    
85 :     val sameChannel = CML.sameChannel
86 :    
87 :     val transmit = CML.sendEvt
88 :     fun transmitc ch msg = CML.sendEvt(ch, msg)
89 :     val receive = CML.recvEvt
90 :    
91 :     (** real-time synchronization **)
92 :     val waitUntil = CML.atTimeEvt
93 :     val timeout = CML.timeOutEvt
94 :    
95 :     end (* structure OldCML *)

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