Changeset 34962 in project


Ignore:
Timestamp:
12/25/17 22:17:20 (6 months ago)
Author:
kon
Message:

a lit'l bit of sugar

File:
1 edited

Legend:

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

    r34961 r34962  
    5858;spin-lock
    5959(define-syntax spin-until
     60  (syntax-rules (from: while:)
     61    ((_  (?done? ...) from: (?_old ?old) while: (?_new ?new))
     62      (let loop ()
     63        (let* (
     64          (?_old ?old)
     65          (?_new ?new) )
     66          ;
     67          (if (begin ?done? ...)
     68            ?_new
     69            (loop) ) ) ) ) ) )
     70
     71#;
     72;spin-lock
     73(define-syntax spin-until
    6074  (syntax-rules ()
    6175    ((_ (?_old ?old) (?_new ?new) ?done? ...)
     
    141155    ((_ ?atm ?_old (?_new ?new))
    142156      (let ((_atm ?atm))
     157        (spin-until
     158          (<atom>-compare-and-set! _atm ?_old ?_new)
     159          from: (?_old (<atom>-value _atm)) while: (?_new ?new))
     160          #;
    143161        (spin-until
    144162          (?_old (<atom>-value _atm))
Note: See TracChangeset for help on using the changeset viewer.