[Gd-chatter] r11155 - in trunk/fundev/sources/io: . streams

hannes at gwydiondylan.org hannes at gwydiondylan.org
Fri Jan 26 01:40:38 CET 2007


Author: hannes
Date: Fri Jan 26 01:40:35 2007
New Revision: 11155

Modified:
   trunk/fundev/sources/io/format.dylan
   trunk/fundev/sources/io/streams/stream.dylan
Log:
Bug: 7183
*implement a lock for streams


Modified: trunk/fundev/sources/io/format.dylan
==============================================================================
--- trunk/fundev/sources/io/format.dylan	(original)
+++ trunk/fundev/sources/io/format.dylan	Fri Jan 26 01:40:35 2007
@@ -125,8 +125,6 @@
     block (exit)
       let start :: <integer> = 0;
       let arg-i :: <integer> = 0;
-      // Ensure all output is contiguous at stream's destination.
-      lock-stream(stream);
       while (start < control-len)
 	// Skip to dispatch char.
 	for (i :: <integer> = start then (i + 1),

Modified: trunk/fundev/sources/io/streams/stream.dylan
==============================================================================
--- trunk/fundev/sources/io/streams/stream.dylan	(original)
+++ trunk/fundev/sources/io/streams/stream.dylan	Fri Jan 26 01:40:35 2007
@@ -24,7 +24,7 @@
     init-keyword: element-type:;
   slot private-stream-direction-value :: <integer>; //  = $input,
    //   init-keyword: direction:;
-  slot private-stream-lock-value = #f;
+  constant slot private-stream-lock-value :: <lock> = make(<recursive-lock>);
 end class <basic-stream>;
 
 define method initialize
@@ -312,27 +312,21 @@
 define method stream-locked?
     (stream :: <stream>) => (locked? :: <boolean>)
   stream-lock(stream)
-  //---*** & stream-lock(stream).owned?
+    & stream-lock(stream).owned?
 end method stream-locked?;
 
 define open generic lock-stream
     (stream :: <stream>) => ();
 
 define method lock-stream (stream :: <stream>) => ()
-  //---*** Implement this
-  // if (stream-lock(stream))
-  //   ---
-  // end
+  wait-for(stream-lock(stream));
 end method lock-stream;
 
 define open generic unlock-stream
     (stream :: <stream>) => ();
 
 define method unlock-stream (stream :: <stream>) => ()
-  //---*** Implement this
-  // if (stream-lock(stream))
-  //   ---
-  // end
+  release(stream-lock(stream))
 end method unlock-stream;
 
 define macro with-stream-locked



More information about the chatter mailing list