[MLton-commit] r6289

Vesa Karvonen vesak at mlton.org
Sun Dec 23 03:16:56 PST 2007


Check file attributes more thoroughly.  This hopefully fixes the race
condition with (re)loading def-use files that are being written.

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

U   mlton/trunk/ide/emacs/def-use-util.el
U   mlton/trunk/ide/emacs/esml-du-mlton.el

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

Modified: mlton/trunk/ide/emacs/def-use-util.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-util.el	2007-12-23 11:14:51 UTC (rev 6288)
+++ mlton/trunk/ide/emacs/def-use-util.el	2007-12-23 11:16:56 UTC (rev 6289)
@@ -143,6 +143,16 @@
        (> (def-use-time-to-double (nth 5 attr1))
           (def-use-time-to-double (nth 5 attr2)))))
 
+(defun def-use-attr-changed? (attr1 attr2)
+  (labels ((nequal i) (not (equal (nth i attr1) (nth i attr2))))
+    (and attr1 attr2
+         (or (def-use-attr-newer? attr1 attr2)
+             (nequal 7)  ;; size
+             (nequal 6)  ;; status change time
+             (nequal 8)  ;; file modes
+             (nequal 10) ;; inode
+             ))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (provide 'def-use-util)

Modified: mlton/trunk/ide/emacs/esml-du-mlton.el
===================================================================
--- mlton/trunk/ide/emacs/esml-du-mlton.el	2007-12-23 11:14:51 UTC (rev 6288)
+++ mlton/trunk/ide/emacs/esml-du-mlton.el	2007-12-23 11:16:56 UTC (rev 6289)
@@ -7,8 +7,6 @@
 (require 'bg-job)
 (require 'esml-util)
 
-;; XXX Fix race condition when (re)loading def-use file that is being written.
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Customization
 
@@ -307,7 +305,7 @@
 
 (defun esml-du-reload (ctx)
   "Reloads the def-use file if it has been modified."
-  (when (def-use-attr-newer?
+  (when (def-use-attr-changed?
           (file-attributes (esml-du-ctx-duf ctx))
           (esml-du-ctx-attr ctx))
     (esml-du-load ctx)))




More information about the MLton-commit mailing list