Changeset 26394 in project


Ignore:
Timestamp:
04/07/12 12:46:03 (8 years ago)
Author:
felix winkelmann
Message:

dot-locking 0.2: incorporated fixed by Claude Marinier

Location:
release/4/dot-locking
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/dot-locking/tags/0.2/dot-locking.scm

    r19482 r26394  
    99
    1010(import scheme chicken)
    11 (use posix extras srfi-18 files)
     11(use posix extras srfi-13 srfi-18 files)
    1212
    1313
     14(define (norm-abs-name file-name)
     15  (normalize-pathname
     16    (if (absolute-pathname? file-name)
     17      file-name
     18      (make-absolute-pathname (current-directory) file-name))))
     19
    1420(define (make-lock-file-name file-name)
    15   (string-append file-name ".lock"))
     21  (string-append (norm-abs-name file-name) ".lock"))
    1622
    1723(define (release-dot-lock file-name)
     
    1925
    2026(define (maybe-obtain-dot-lock file-name)
    21   (let ((temp-name (create-temporary-file file-name)))
     27  (let ((temp-name (create-temporary-file)))
    2228    (handle-exceptions ex
    2329        (begin
     
    4753               (handle-exceptions ex #f
    4854                 (> (current-seconds)
    49                     (+ (file-modification-time (make-lock-file-name file-name))
     55                    (+ (file-modification-time lock-file-name)
    5056                       stale-time))))
    5157          (break-dot-lock file-name)
     
    5359         (else
    5460          (thread-sleep!
    55            (+ (quotient (* retry-interval 3) 4)
     61           (+ 1 (quotient (* retry-interval 3) 4)
    5662              (random (quotient retry-interval 2))))
    5763          (cond ((not retry-number)
     
    8288    (with-dot-lock* file-name (lambda () body ...)))))
    8389
    84 
    8590)
  • release/4/dot-locking/tags/0.2/dot-locking.setup

    r19482 r26394  
    77 'dot-locking
    88 '("dot-locking.so" "dot-locking.import.so")
    9  '((version 0.1)))
     9 '((version 0.2)))
  • release/4/dot-locking/trunk/dot-locking.scm

    r19482 r26394  
    99
    1010(import scheme chicken)
    11 (use posix extras srfi-18 files)
     11(use posix extras srfi-13 srfi-18 files)
    1212
    1313
     14(define (norm-abs-name file-name)
     15  (normalize-pathname
     16    (if (absolute-pathname? file-name)
     17      file-name
     18      (make-absolute-pathname (current-directory) file-name))))
     19
    1420(define (make-lock-file-name file-name)
    15   (string-append file-name ".lock"))
     21  (string-append (norm-abs-name file-name) ".lock"))
    1622
    1723(define (release-dot-lock file-name)
     
    1925
    2026(define (maybe-obtain-dot-lock file-name)
    21   (let ((temp-name (create-temporary-file file-name)))
     27  (let ((temp-name (create-temporary-file)))
    2228    (handle-exceptions ex
    2329        (begin
     
    4753               (handle-exceptions ex #f
    4854                 (> (current-seconds)
    49                     (+ (file-modification-time (make-lock-file-name file-name))
     55                    (+ (file-modification-time lock-file-name)
    5056                       stale-time))))
    5157          (break-dot-lock file-name)
     
    5359         (else
    5460          (thread-sleep!
    55            (+ (quotient (* retry-interval 3) 4)
     61           (+ 1 (quotient (* retry-interval 3) 4)
    5662              (random (quotient retry-interval 2))))
    5763          (cond ((not retry-number)
     
    8288    (with-dot-lock* file-name (lambda () body ...)))))
    8389
    84 
    8590)
  • release/4/dot-locking/trunk/dot-locking.setup

    r19482 r26394  
    77 'dot-locking
    88 '("dot-locking.so" "dot-locking.import.so")
    9  '((version 0.1)))
     9 '((version 0.2)))
Note: See TracChangeset for help on using the changeset viewer.