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/cml-lib/SMLNJ-Util/cml-atom-new.sml
ViewVC logotype

Annotation of /sml/trunk/src/cml/cml-lib/SMLNJ-Util/cml-atom-new.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1759 - (view) (download)

1 : mblume 1759 (* cml-atom-new.sml
2 :     *
3 :     * Thread-safe version of Atom (protecting the global hashtable
4 :     * with a lock).
5 :     *
6 :     * Copyright (c) 2005 by The Fellowship of SML/NJ
7 :     *
8 :     * Author: Matthias Blume (blume@tti-c.org)
9 :     *)
10 :     structure Atom : ATOM = struct
11 :    
12 :     open Atom (* from $/smlnj-lib.cm *)
13 :    
14 :     local val l: unit Mailbox.mbox = Mailbox.mailbox ()
15 :     in
16 :     fun atomically f arg = (Mailbox.send (l, ()); f arg before Mailbox.recv l)
17 :     end
18 :    
19 :     val atom = atomically atom
20 :     val atom' = atomically atom'
21 :     end

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