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

SCM Repository

[smlnj] View of /sml/trunk/src/cml/cml-lib/SMLNJ-Util/cml-atom-new.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1759 - (download) (annotate)
Thu Feb 24 22:46:30 2005 UTC (16 years, 6 months ago) by mblume
File size: 506 byte(s)
fixed/improved structure Atom in CML
(* cml-atom-new.sml
 *
 *   Thread-safe version of Atom (protecting the global hashtable
 *   with a lock).
 *
 * Copyright (c) 2005 by The Fellowship of SML/NJ
 *
 * Author: Matthias Blume (blume@tti-c.org)
 *)
structure Atom : ATOM = struct

    open Atom			(* from $/smlnj-lib.cm *)

    local val l: unit Mailbox.mbox = Mailbox.mailbox ()
    in
    fun atomically f arg = (Mailbox.send (l, ()); f arg before Mailbox.recv l)
    end

    val atom = atomically atom
    val atom' = atomically atom'
end

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