From 97a52a58bc011e26c72835fb71584fc2cc6f29ef Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 17 Sep 2010 22:50:56 -0600 Subject: [PATCH] cocoa: don't over-poll for events --- collects/mred/private/wx/cocoa/queue.rkt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/collects/mred/private/wx/cocoa/queue.rkt b/collects/mred/private/wx/cocoa/queue.rkt index 8633d1ec16..a5b02f24cc 100644 --- a/collects/mred/private/wx/cocoa/queue.rkt +++ b/collects/mred/private/wx/cocoa/queue.rkt @@ -268,8 +268,15 @@ (define (cocoa-start-event-pump) (thread (lambda () (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) + ;; Something is ready, so dispatch: (atomically (dispatch-all-ready)) + ;; Periodically free everything in the default allocation pool: (queue-autorelease-flush) (loop)))))