(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/misc/barrier#barrier::t
    (make-struct-type
     'std/misc/barrier#barrier::t
     '#f
     '5
     'barrier
     '((final: . #t))
     ':init!
     '(mx cv count limit exn)))
  (define std/misc/barrier#barrier?
    (make-struct-predicate std/misc/barrier#barrier::t))
  (define std/misc/barrier#make-barrier
    (lambda _$args180379_
      (apply make-struct-instance std/misc/barrier#barrier::t _$args180379_)))
  (define std/misc/barrier#barrier-mx
    (make-struct-field-accessor std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#barrier-cv
    (make-struct-field-accessor std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#barrier-count
    (make-struct-field-accessor std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#barrier-limit
    (make-struct-field-accessor std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#barrier-exn
    (make-struct-field-accessor std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#barrier-mx-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#barrier-cv-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#barrier-count-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#barrier-limit-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#barrier-exn-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#&barrier-mx
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#&barrier-cv
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#&barrier-count
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#&barrier-limit
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#&barrier-exn
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#&barrier-mx-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#&barrier-cv-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#&barrier-count-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#&barrier-limit-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#&barrier-exn-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#barrier:::init!
    (lambda (_self180376_ _limit180377_)
      (if (and (fixnum? _limit180377_) (##fx>= _limit180377_ '0))
          '#!void
          (error '"Invalid argument; expected positive fixnum" _limit180377_))
      (if (##fx< '4 (##vector-length _self180376_))
          (begin
            (##vector-set! _self180376_ '1 (make-mutex 'barrier))
            (##vector-set! _self180376_ '2 (make-condition-variable 'barrier))
            (##vector-set! _self180376_ '3 '0)
            (##vector-set! _self180376_ '4 _limit180377_))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self180376_))))
  (bind-method!
   std/misc/barrier#barrier::t
   ':init!
   std/misc/barrier#barrier:::init!
   '#f)
  (define std/misc/barrier#barrier-wait!
    (lambda (_b180202_)
      (let* ((_b180203180212_ _b180202_)
             (_E180205180216_
              (lambda () (error '"No clause matching" _b180203180212_)))
             (_K180206180233_
              (lambda (_limit180219_ _cv180220_ _mx180221_)
                (let _lp180223_ ()
                  (mutex-lock! _mx180221_)
                  (let* ((_count180226_
                          (##unchecked-structure-ref
                           _b180202_
                           '3
                           std/misc/barrier#barrier::t
                           '#f))
                         (_$e180228_
                          (##unchecked-structure-ref
                           _b180202_
                           '5
                           std/misc/barrier#barrier::t
                           '#f)))
                    (if _$e180228_
                        ((lambda (_exn180231_)
                           (mutex-unlock! _mx180221_)
                           (raise _exn180231_))
                         _$e180228_)
                        (if (##fx< _count180226_ _limit180219_)
                            (begin
                              (mutex-unlock! _mx180221_ _cv180220_)
                              (_lp180223_))
                            (begin (mutex-unlock! _mx180221_) '#!void))))))))
        (if (##structure-direct-instance-of?
             _b180203180212_
             'std/misc/barrier#barrier::t)
            (let* ((_e180207180236_ (##vector-ref _b180203180212_ '1))
                   (_mx180239_ _e180207180236_)
                   (_e180208180241_ (##vector-ref _b180203180212_ '2))
                   (_cv180244_ _e180208180241_)
                   (_e180209180246_ (##vector-ref _b180203180212_ '3))
                   (_e180210180249_ (##vector-ref _b180203180212_ '4))
                   (_limit180252_ _e180210180249_))
              (_K180206180233_ _limit180252_ _cv180244_ _mx180239_))
            (_E180205180216_)))))
  (define std/misc/barrier#barrier-post!
    (lambda (_b180155_)
      (let* ((_b180156180165_ _b180155_)
             (_E180158180169_
              (lambda () (error '"No clause matching" _b180156180165_)))
             (_K180159180181_
              (lambda (_limit180172_ _cv180173_ _mx180174_)
                (mutex-lock! _mx180174_)
                (let* ((_count180176_
                        (##unchecked-structure-ref
                         _b180155_
                         '3
                         std/misc/barrier#barrier::t
                         '#f))
                       (_count+1180178_ (##fx+ _count180176_ '1)))
                  (##unchecked-structure-set!
                   _b180155_
                   _count+1180178_
                   '3
                   std/misc/barrier#barrier::t
                   '#f)
                  (if (##fx< _count+1180178_ _limit180172_)
                      '#!void
                      (condition-variable-broadcast! _cv180173_))
                  (mutex-unlock! _mx180174_)))))
        (if (##structure-direct-instance-of?
             _b180156180165_
             'std/misc/barrier#barrier::t)
            (let* ((_e180160180184_ (##vector-ref _b180156180165_ '1))
                   (_mx180187_ _e180160180184_)
                   (_e180161180189_ (##vector-ref _b180156180165_ '2))
                   (_cv180192_ _e180161180189_)
                   (_e180162180194_ (##vector-ref _b180156180165_ '3))
                   (_e180163180197_ (##vector-ref _b180156180165_ '4))
                   (_limit180200_ _e180163180197_))
              (_K180159180181_ _limit180200_ _cv180192_ _mx180187_))
            (_E180158180169_)))))
  (define std/misc/barrier#barrier-error!
    (lambda (_b180123_ _exn180124_)
      (let* ((_b180125180132_ _b180123_)
             (_E180127180136_
              (lambda () (error '"No clause matching" _b180125180132_)))
             (_K180128180142_
              (lambda (_cv180139_ _mx180140_)
                (mutex-lock! _mx180140_)
                (if (##unchecked-structure-ref
                     _b180123_
                     '5
                     std/misc/barrier#barrier::t
                     '#f)
                    '#!void
                    (##unchecked-structure-set!
                     _b180123_
                     _exn180124_
                     '5
                     std/misc/barrier#barrier::t
                     '#f))
                (condition-variable-broadcast! _cv180139_)
                (mutex-unlock! _mx180140_))))
        (if (##structure-direct-instance-of?
             _b180125180132_
             'std/misc/barrier#barrier::t)
            (let* ((_e180129180145_ (##vector-ref _b180125180132_ '1))
                   (_mx180148_ _e180129180145_)
                   (_e180130180150_ (##vector-ref _b180125180132_ '2))
                   (_cv180153_ _e180130180150_))
              (_K180128180142_ _cv180153_ _mx180148_))
            (_E180127180136_))))))
