Changeset 35000 in project


Ignore:
Timestamp:
01/11/18 03:15:51 (5 days ago)
Author:
kon
Message:

language people

Location:
release/4/thread-utils/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/thread-utils/trunk/atomic-value.scm

    r34999 r35000  
    77;; - umm, just look
    88;;
    9 ;;  - something like mutex-conditions for state-change watchers?
     9;; - something like mutex-conditions for state-change watchers?
    1010
    1111;;;
     
    6363;;
    6464
    65 (define ((argument n) . args)
     65;combinator
     66(define ((nth-arg n) . args)
    6667  (list-ref args n) )
    6768
     
    8788;
    8889
    89 ;mutex-specific = proc/0-1
     90;mutex-specific is value-store
    9091(define-type <atom> (struct mutex))
    9192
     
    111112  (make-<atom> (make-<atom>-wrapper next) ) )
    112113
     114;initial possible w/ a mode
    113115(define (make-<atom>-wrapper next #!optional (initial (default-atom-value)))
    114116  (let (
    115117    (+value+ initial) )
    116118    ;
    117     (define boxprc
     119    (define wrapper
    118120      (case-lambda
    119121        (()
     
    121123        ((ival)
    122124          (set! +value+ (next +value+ ival))
    123           boxprc )
     125          wrapper )
    124126        ((mode wrap)
    125127          (let (
     
    133135                  (lambda (o n) (wrap o (next o (wrap o n)))) ) ) ) )
    134136            (set! next next-next) )
    135           boxprc ) ) )
    136     ;
    137     boxprc ) )
     137          wrapper ) ) )
     138    ;
     139    wrapper ) )
    138140
    139141(define-inline (<atom>-wrapped? atm)
     
    299301;
    300302(define: (atom-wrap . (args (list (or boolean (* * --> *))))) --> <atom>
    301   (let ((next (optional args (argument 1))))
     303  (let ((next (optional args (nth-arg 1))))
    302304    (make-wrapped-<atom> (check-procedure 'atom-wrap next 'next)) ) )
    303305
  • release/4/thread-utils/trunk/tests/atomic-value-test.scm

    r34999 r35000  
    1111(cond-expand (chicken-4 (use numbers)))
    1212
    13 #| ;UNTIL RELEASE
     13#| ;UNTIL RELEASED
    1414(use typed-define)
    15 ;
    16 (define: (atom-zero! (atm <atom>)) -> number
    17   (atom-set! atm 0) )
    1815;
    1916(define: (atom-add1! (atm <atom>)) -> number
     
    2320  (atom-call! atm sub1) )
    2421|#
    25 ;
    26 (define (atom-zero! atm)
    27   (atom-set! atm 0) )
    2822;
    2923(define (atom-add1! atm)
     
    6963(test-group "counter"
    7064  (let ((a (make-atom)))
    71     (test 0 (begin (atom-zero! a) (atom-value a)))
     65    (test 0 (begin (atom-set! a 0) (atom-value a)))
    7266    (test 1 (begin (atom-add1! a) (atom-value a)))
    7367    (test 0 (begin (atom-sub1! a) (atom-value a))) )
     
    8074(test-group "counter w/ mutator"
    8175  (let ((a (atom-mutate (atom 0) add1)))                ;     +1
    82     (test 1 (begin (atom-zero! a) (atom-value a)))      ;0    +1
     76    (test 1 (begin (atom-set! a 0) (atom-value a)))      ;0    +1
    8377    (test 3 (begin (atom-add1! a) (atom-value a)))      ;1 +1 +1
    8478    (test 3 (begin (atom-sub1! a) (atom-value a))) )    ;3 -1 +1
Note: See TracChangeset for help on using the changeset viewer.