[MLton-commit] r5358

Vesa Karvonen vesak at mlton.org
Wed Feb 28 01:45:06 PST 2007


Removed the space safety feature from enque, because it breaks when
multiple agents are mutating the queue at the same time.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml
===================================================================
--- mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml	2007-02-28 09:37:05 UTC (rev 5357)
+++ mltonlib/trunk/com/ssh/misc-util/unstable/queue.sml	2007-02-28 09:44:59 UTC (rev 5358)
@@ -7,9 +7,7 @@
 (*
  * An implementation of an extended version of the {QUEUE} signature.  The
  * extensions aren't part of the {QUEUE} signature, because they don't
- * make sense for all possible implementations of the signature.  This
- * implementation is based on a space safe implementation by Stephen Weeks
- * posted on the MLton developers mailing list.
+ * make sense for all possible implementations of the signature.
  *)
 structure Queue :> sig
    include QUEUE
@@ -35,14 +33,13 @@
    fun length (IN {front, ...}) =
        N.length (!front)
 
-   fun enque (IN {back, ...}) =
-       fn a => let
-          val r = !back
-          val n = N.new ()
-       in
-          N.<- (r, SOME (a, n))
+   fun enque (IN {back, ...}) a = let
+      val r = !back
+      val n = N.new ()
+   in
+      N.<- (r, SOME (a, n))
         ; back := n
-       end
+   end
 
    fun deque (IN {front, ...}) =
        case N.get (!front) of




More information about the MLton-commit mailing list