Drain multiple external ground events at once. (Good or bad idea?)
This commit is contained in:
parent
65b2c94161
commit
38c6bfd20e
1 changed files with 16 additions and 6 deletions
|
@ -40,14 +40,24 @@
|
|||
(define ground-event-relay-actor #f)
|
||||
(define background-activity-count 0)
|
||||
|
||||
(define (handle-ground-event-item item)
|
||||
(match item
|
||||
[(? procedure? proc)
|
||||
(push-script! ground-event-relay-actor
|
||||
(lambda () (proc ground-event-relay-actor)))]
|
||||
[(? number? delta)
|
||||
(set! background-activity-count (+ background-activity-count delta))]))
|
||||
|
||||
(define (drain-external-events)
|
||||
(define item (async-channel-try-get ch))
|
||||
(when item
|
||||
(handle-ground-event-item item)
|
||||
(drain-external-events)))
|
||||
|
||||
(define ground-event-relay-evt
|
||||
(handle-evt ch (lambda (item)
|
||||
(match item
|
||||
[(? procedure? proc)
|
||||
(push-script! ground-event-relay-actor
|
||||
(lambda () (proc ground-event-relay-actor)))]
|
||||
[(? number? delta)
|
||||
(set! background-activity-count (+ background-activity-count delta))]))))
|
||||
(handle-ground-event-item item)
|
||||
(drain-external-events))))
|
||||
|
||||
(define ds (make-dataspace
|
||||
(lambda ()
|
||||
|
|
Loading…
Reference in a new issue