CVS: sml-dist/src/cml/cml-lib/SMLNJ-Util cml-atom-new.sml,NONE,1.1
Matthias Blume <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml-dist/src/cml/cml-lib/SMLNJ-Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20173/src/cml/cml-lib/SMLNJ-Util Added Files: cml-atom-new.sml Log Message: fixed/improved structure Atom in CML --- NEW FILE: cml-atom-new.sml --- (* 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 ([email protected]) *) 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 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click