Changeset 38596 in project for release


Ignore:
Timestamp:
04/07/20 04:04:26 (4 months ago)
Author:
Kon Lovett
Message:

add use-timed-resource

Location:
release/5/timed-resource/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/timed-resource/trunk/tests/timed-resource-test.scm

    r38579 r38596  
    6363      ;NOTE only because used once; brittle!
    6464      (test-assert "Resource Cannot Be Open" (not (timed-resource-open? +tr+)))
    65       (call-with-timed-resource +tr+ (cut read-blob cnt <>)) ) ) )
     65      (use-timed-resource (+tr+ v) (read-blob cnt v)) ) ) )
    6666
    6767;;;
  • release/5/timed-resource/trunk/timed-resource.egg

    r38579 r38596  
    22
    33((synopsis "Resource w/ Timeout")
    4  (version "2.2.1")
     4 (version "2.3.0")
    55 (category misc)
    66 (author "[[kon lovett]]")
  • release/5/timed-resource/trunk/timed-resource.scm

    r38579 r38596  
    1717  timed-resource-name
    1818  call-with-timed-resource
     19  use-timed-resource
     20  ;deprecated
    1921  with-timed-resource)
    2022
     
    253255      #f #f) ) )
    254256
    255 #; ;FIXME struct tag (timed-resource) & check-
    256 (define-syntax use-timed-resource
    257   (syntax-rules ()
    258     ((use-timed-resource (?tr ?v) ?body ...)
    259       (let ((tr (check-timed-resource 'use-timed-resource ?tr)))
    260         (unless (timed-resource-shutdown?) ;Shouldn't be necessary
    261           (record-synch tr timed-resource
    262             (let ((?v (timed-resource-aquire tr)))
    263               ?body ...) ) ) ) ) ) )
    264 
    265 (define ( call-with-timed-resource tr proc)
     257(define (call-with-timed-resource tr proc)
    266258  (check-timed-resource 'with-timed-resource tr)
    267259  (check-procedure 'with-timed-resource proc)
     
    269261    (record-synch tr timed-resource (proc (timed-resource-aquire tr))) ) )
    270262
     263(define-syntax use-timed-resource
     264  (syntax-rules ()
     265    ((use-timed-resource (?tr ?v) ?body ...)
     266      (call-with-timed-resource ?tr (lambda (?v) ?body ...)) ) ) )
     267
    271268) ;module timed-resource
Note: See TracChangeset for help on using the changeset viewer.