avoid a little copying
This commit is contained in:
parent
23f9677e52
commit
62a70a6593
|
@ -3320,7 +3320,7 @@
|
||||||
[(potential-commits new-commit-response-evts)
|
[(potential-commits new-commit-response-evts)
|
||||||
(separate
|
(separate
|
||||||
committers
|
committers
|
||||||
(service-committer data peeker-evt))])
|
(service-committer (at-queue-size data) peeker-evt))])
|
||||||
(when (and on-peek
|
(when (and on-peek
|
||||||
(not (null? not-ready-peekers)))
|
(not (null? not-ready-peekers)))
|
||||||
(parameterize ([current-eventspace eventspace])
|
(parameterize ([current-eventspace eventspace])
|
||||||
|
@ -3343,7 +3343,7 @@
|
||||||
(handle-evt
|
(handle-evt
|
||||||
read-chan
|
read-chan
|
||||||
(λ (ent)
|
(λ (ent)
|
||||||
(set! data (at-enqueue ent data))
|
(at-enqueue! ent data)
|
||||||
(unless position
|
(unless position
|
||||||
(set! position (cdr ent)))
|
(set! position (cdr ent)))
|
||||||
(loop)))
|
(loop)))
|
||||||
|
@ -3443,23 +3443,22 @@
|
||||||
;; service-committer : queue evt -> committer -> (union #f evt)
|
;; service-committer : queue evt -> committer -> (union #f evt)
|
||||||
;; if the committer can be dumped, return an evt that
|
;; if the committer can be dumped, return an evt that
|
||||||
;; does the dumping. otherwise, return #f
|
;; does the dumping. otherwise, return #f
|
||||||
(define ((service-committer data peeker-evt) a-committer)
|
(define ((service-committer size peeker-evt) a-committer)
|
||||||
(match a-committer
|
(match a-committer
|
||||||
[(struct committer
|
[(struct committer
|
||||||
(kr commit-peeker-evt
|
(kr commit-peeker-evt
|
||||||
done-evt resp-chan resp-nack))
|
done-evt resp-chan resp-nack))
|
||||||
(let ([size (at-queue-size data)])
|
(cond
|
||||||
(cond
|
[(not (eq? peeker-evt commit-peeker-evt))
|
||||||
[(not (eq? peeker-evt commit-peeker-evt))
|
(choice-evt
|
||||||
(choice-evt
|
resp-nack
|
||||||
resp-nack
|
(channel-put-evt resp-chan #f))]
|
||||||
(channel-put-evt resp-chan #f))]
|
[(< size kr)
|
||||||
[(< size kr)
|
(choice-evt
|
||||||
(choice-evt
|
resp-nack
|
||||||
resp-nack
|
(channel-put-evt resp-chan 'commit-failure))]
|
||||||
(channel-put-evt resp-chan 'commit-failure))]
|
[else ;; commit succeeds
|
||||||
[else ;; commit succeeds
|
#f])]))
|
||||||
#f]))]))
|
|
||||||
|
|
||||||
;; service-waiter : peeker -> (union #f evt)
|
;; service-waiter : peeker -> (union #f evt)
|
||||||
;; if the peeker can be serviced, build an event to service it
|
;; if the peeker can be serviced, build an event to service it
|
||||||
|
@ -4936,6 +4935,9 @@ designates the character that triggers autocompletion
|
||||||
(cons e (at-queue-front q))
|
(cons e (at-queue-front q))
|
||||||
(at-queue-back q)
|
(at-queue-back q)
|
||||||
(+ (at-queue-count q) 1)))
|
(+ (at-queue-count q) 1)))
|
||||||
|
(define (at-enqueue! e q)
|
||||||
|
(set-at-queue-front! q (cons e (at-queue-front q)))
|
||||||
|
(set-at-queue-count! q (+ (at-queue-count q) 1)))
|
||||||
(define (at-queue-first q)
|
(define (at-queue-first q)
|
||||||
(at-flip-around q)
|
(at-flip-around q)
|
||||||
(let ([back (at-queue-back q)])
|
(let ([back (at-queue-back q)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user