~nilium/hardwood

44ddd8539a301ae7c00f4a95860009cdc11133bb — Adrien Ramos 10 years ago b4d55d6
Fix `recv` expansion and a bug in `!?`
3 files changed, 6 insertions(+), 3 deletions(-)

M hardwood-impl.scm
M hardwood.scm
M tests/rpc.scm
M hardwood-impl.scm => hardwood-impl.scm +3 -3
@@ 150,7 150,7 @@
             (timeout-clause (alist-ref 'after clauses compare))
             (timeout (and timeout-clause (car timeout-clause)))
             (timeout-proc (and timeout-clause (cadr timeout-clause)))
             (clauses (remove (lambda (e) (eqv? (car e) 'after)) clauses)))
             (clauses (alist-delete 'after clauses compare)))
        `(rcv-msg (lambda (m)
                    (handle-exceptions exn
                                       (if (no-match-condition? exn)


@@ 166,7 166,7 @@
  (let ((tag (make-tag)))
    (! pid (list (self) tag msg))
    (recv
      ((tag reply)  reply)
      (((? (cut equal? <> tag)) reply)  reply)
      (after timeout (if (eqv? default no-default) (no-default) default)))))

(define (! pid msg)


@@ 201,7 201,7 @@
         (lock (hardwood-monitors-lock specific))
         (monitors (and (mutex-lock! lock)
                        (hardwood-monitors specific))))
    (hardwood-monitors-set! specific (remove (cut equal? ref <>) monitors))
    (hardwood-monitors-set! specific (delete ref monitors))
    (mutex-unlock! lock)))

(define (alert-monitors reason)

M hardwood.scm => hardwood.scm +1 -0
@@ 30,6 30,7 @@
(module hardwood

        (!
         !!
         !?
         ?
         ??

M tests/rpc.scm => tests/rpc.scm +2 -0
@@ 8,4 8,6 @@
           (! from (list tag (+ a b)))))
        (loop)))))

(! (self) (list (make-tag) 0))
(assert (= (!? rpc-server '(add 21 21)) 42))
(?)