Changeset 34959 in project


Ignore:
Timestamp:
12/25/17 20:11:39 (3 weeks ago)
Author:
kon
Message:

refine since already define

File:
1 edited

Legend:

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

    r34914 r34959  
    3636  atom-mutate! )
    3737
    38 (import scheme)
    39 
    40 (import chicken)
    41 
    42 (use srfi-18)
    43 
    44 (use (only miscmacros define-parameter))
    45 
    46 (use (only moremacros ->boolean))
    47 
    48 (use (only type-checks check-structure check-procedure))
    49 (use (only type-errors signal-type-error make-error-type-message))
    50 
    51 (use typed-define)
     38(import
     39  scheme
     40  chicken)
     41
     42(use
     43  srfi-18
     44  (only miscmacros define-parameter)
     45  (only moremacros ->boolean)
     46  (only type-checks check-structure check-procedure)
     47  (only type-errors signal-type-error make-error-type-message)
     48  typed-define)
    5249
    5350;;
     
    6057    ((_ (?_old ?old) (?_new ?new) ?done? ...)
    6158      (let loop ()
    62         (let* ((?_old ?old) (?_new ?new))
     59        (let* (
     60          (?_old ?old)
     61          (?_new ?new) )
     62          ;
    6363          (if (begin ?done? ...)
    6464            ?_new
     
    7171;;
    7272
    73 (define-inline (make-<atom> mu va)
    74   (mutex-specific-set! mu va)
    75   mu )
     73;
    7674
    7775(define-type <atom> (struct mutex))
     76
     77;
     78
     79(define-inline (make-<atom> va)
     80  (let ((mu (make-mutex '<atom>)))
     81    (mutex-specific-set! mu va)
     82    mu ) )
    7883
    7984(define-inline (<atom>? obj)
     
    97102  atm )
    98103
    99 ;;
     104;
    100105
    101106(define-inline (<atom>-lock! atm)
     
    114119          (lambda () (<atom>-unlock! _atm))) ) ) ) )
    115120
    116 ;;
     121;
    117122
    118123(define-inline (<atom>-compare-and-set! atm old new)
     
    136141          (<atom>-compare-and-set! _atm ?_old ?_new)) ) ) ) )
    137142
    138 ;;
     143;
    139144
    140145(define-inline (<atom>-value-set!-synch atm val)
     
    157162(define: (make-atom . (args (list *))) --> <atom>
    158163  (let ((val (optional args (default-atom-value))))
    159     (make-<atom> (make-mutex '<atom>) val) ) )
     164    (atom val) ) )
    160165
    161166;
    162167(define: (atom (val *)) --> <atom>
    163168  ;just in case doesn't inline make-atom
    164   (make-<atom> (make-mutex '<atom>) val) )
     169  (make-<atom> val) )
    165170
    166171;
Note: See TracChangeset for help on using the changeset viewer.