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 1770 - (download) (annotate)
Tue Mar 1 05:43:28 2005 UTC (15 years, 7 months ago) by mblume
File size: 485 byte(s)
fixed silly bug in CML:Atom
(* 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 = SyncVar.mVarInit ()
    in
    fun atomically f a = (SyncVar.mTake l; f a before SyncVar.mPut (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