cocoa: don't over-poll for events
This commit is contained in:
parent
0519ef991c
commit
97a52a58bc
|
@ -268,8 +268,15 @@
|
||||||
(define (cocoa-start-event-pump)
|
(define (cocoa-start-event-pump)
|
||||||
(thread (lambda ()
|
(thread (lambda ()
|
||||||
(let loop ()
|
(let loop ()
|
||||||
|
;; Wait 50 msecs between event polling, unless nothing
|
||||||
|
;; else is going on:
|
||||||
|
(sync/timeout 0.05 (system-idle-evt))
|
||||||
|
;; Wait until event is ready --- but waiting is implemented
|
||||||
|
;; by polling:
|
||||||
(sync queue-evt)
|
(sync queue-evt)
|
||||||
|
;; Something is ready, so dispatch:
|
||||||
(atomically (dispatch-all-ready))
|
(atomically (dispatch-all-ready))
|
||||||
|
;; Periodically free everything in the default allocation pool:
|
||||||
(queue-autorelease-flush)
|
(queue-autorelease-flush)
|
||||||
(loop)))))
|
(loop)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user