[Gd-chatter] r11206 - trunk/libraries/programming-tools/multi-thread-test

hannes at gwydiondylan.org hannes at gwydiondylan.org
Fri Feb 23 02:03:32 CET 2007


Author: hannes
Date: Fri Feb 23 02:03:30 2007
New Revision: 11206

Modified:
   trunk/libraries/programming-tools/multi-thread-test/library.dylan
   trunk/libraries/programming-tools/multi-thread-test/multi-thread-test.dylan
Log:
Job: minor
some local modifications I had here


Modified: trunk/libraries/programming-tools/multi-thread-test/library.dylan
==============================================================================
--- trunk/libraries/programming-tools/multi-thread-test/library.dylan	(original)
+++ trunk/libraries/programming-tools/multi-thread-test/library.dylan	Fri Feb 23 02:03:30 2007
@@ -14,4 +14,7 @@
   use threads;
   use format-out;
   use simple-random;
+  use standard-io;
+  use streams;
+  use format;
 end;

Modified: trunk/libraries/programming-tools/multi-thread-test/multi-thread-test.dylan
==============================================================================
--- trunk/libraries/programming-tools/multi-thread-test/multi-thread-test.dylan	(original)
+++ trunk/libraries/programming-tools/multi-thread-test/multi-thread-test.dylan	Fri Feb 23 02:03:30 2007
@@ -21,14 +21,18 @@
   with-lock (ts.lock)
     add!(ts.threads, count)
   end;
+  //let barf = format-to-string("%s", "FOOOO");
   format-out("Hello from %d\n",count);
-  collect-garbage();
-  //sleep(modulo(random(100000), 5));
-  //format-out("Hello from %d\n",count);
+  //sleep(modulo(random(100000), 3));
+  //format(*standard-output*, "Hello from\n");
+  format-out("Hello from\n"); //,count);
+  //write(*standard-output*, "foobar\n");
+  //collect-garbage();
+  //sleep(1);
   with-lock (ts.lock)
     remove!(ts.threads, count)
   end;
-  format-out("End from %d\n",count);
+  //format-out("End from %d\n",count);
 end;
 
 define function main () => ()
@@ -41,7 +45,7 @@
         format-out("Started %d thread [%d]\n", count, ts.threads.size);
       end;
     exception (c :: <condition>)
-      format-out("Received condition %=\n", c);
+      //write(*standard-output*, "Received condition\n");
       sleep(1);
     end;
   end;
@@ -49,4 +53,30 @@
 
 begin
   main();
+/*  for(i from 0 below 10000000)
+    lock-stream(*standard-output*);
+    unlock-stream(*standard-output*);
+    end */
 end;
+
+define open generic spawn-thread(i);
+
+define method spawn-thread(i) => ()
+  make(<thread>, function: method() sleep(i) end);
+  values();
+end;
+/*
+begin
+  while(#t)
+    block()
+      spawn-thread(1);
+      collect-garbage();
+    exception (c :: <condition>)
+      sleep(1);
+    end;
+  end
+//  main();
+end;
+
+
+*/



More information about the chatter mailing list