[Gd-chatter] r11513 - trunk/libraries/network/web-framework

hannes at gwydiondylan.org hannes at gwydiondylan.org
Tue Dec 4 06:31:45 CET 2007


Author: hannes
Date: Tue Dec  4 06:31:44 2007
New Revision: 11513

Modified:
   trunk/libraries/network/web-framework/storage.dylan
Log:
Job: minor
ups, wanted to have a lock and a notification here


Modified: trunk/libraries/network/web-framework/storage.dylan
==============================================================================
--- trunk/libraries/network/web-framework/storage.dylan	(original)
+++ trunk/libraries/network/web-framework/storage.dylan	Tue Dec  4 06:31:44 2007
@@ -199,28 +199,25 @@
   end;
 end;
 
-define variable *dump?* = #f;
+define constant $dump? = make(<lock>);
+define constant $dump-notification
+  = make(<notification>, lock: $dump?);
 
 define function query-dump ()
-  *dump?* := #t;
+  with-lock($dump?)
+    release($dump-notification);
+  end;
 end;
 
 define function do-dump ()
   make(<thread>,
        function: method()
-                     sleep(4);
-                     let i :: <integer> = 0;
                      while(#t)
-                       if (i > 60)
-                         *dump?* := #t;
-                         i := 0;
-                       end;
-                       if (*dump?*)
-                         dump-data();
-                         *dump?* := #f;
+                       with-lock($dump?)
+                         wait-for($dump-notification)
                        end;
-                       i := i + 1;
-                       sleep(60);
+                       dump-data();
+                       sleep(10); //maximal dump every 10 seconds
                      end
                  end);
 end;



More information about the chatter mailing list