OK. This is all about interrupts, not atomicity nor aborts.
sfile.scm:202: (without-interrupts
+ Caller: allocate-temporary-file
sfile.scm:216: (without-interrupts
+ Caller: deallocate-temporary-file
+
+ Added a files-to-delete-mutex to serialize access to the
+ files-to-delete element of the fixed-objects vector.
string.scm:178: (let ((mask (set-interrupt-enables! interrupt-mask/none)))
string.scm:199: (set-interrupt-enables! mask)
(lambda () (receiver pathname))
(lambda () (deallocate-temporary-file pathname)))))
+(define files-to-delete-mutex (make-thread-mutex))
+
+(define (with-files-to-delete-locked thunk)
+ (with-thread-mutex-locked files-to-delete-mutex
+ (lambda () (without-interruption thunk))))
+
(define (allocate-temporary-file pathname)
(and (not (file-exists? pathname))
(let ((objects (get-fixed-objects-vector))
(slot (fixed-objects-vector-slot 'FILES-TO-DELETE))
(filename (->namestring pathname)))
- (without-interrupts
+ (with-files-to-delete-locked
(lambda ()
(and (file-touch pathname)
(begin
(let ((objects (get-fixed-objects-vector))
(slot (fixed-objects-vector-slot 'FILES-TO-DELETE))
(filename (->namestring pathname)))
- (without-interrupts
+ (with-files-to-delete-locked
(lambda ()
(vector-set! objects slot
(delete! filename (vector-ref objects slot)))