Re: [RESOLVED] process events in tight loop?
Re: [RESOLVED] process events in tight loop?
- Subject: Re: [RESOLVED] process events in tight loop?
- From: Chase <email@hidden>
- Date: Thu, 14 Jul 2005 02:28:24 -0500
On Jul 14, 2005, at 1:20 AM, Bill Bumgarner wrote:
Except that your application will never actually idle -- it will
always use CPU cycles even when hidden.
Not in this case. It's an nsstatusitem / backgroundonly app with a
window that can be opened from the status item. The app can't be
hidden because it's background only and the thread is only running
while the window is open, which is rare. also the window closes
after a few seconds, so spinning only happens very infrequently and
for a very brief amount of time.
When using a threaded based solution, you should really put some
effort into insuring that the worker thread(s) do not spin. Ever.
You're preaching to the choir, Bill. I am probably to most event-
driven/anti-polling person there ever was, and I truly tried every
other means I could think of to stay aware of mouse position in a
background-only app, but this appears to be the only way to get the
job done.
If anyone knows how to receive mouseMoved events in a background-only
app, I'd love to hear about it. But I don't think such is possible
since, in most cases, it defies the very nature of a background-only
app to receive mouse moved events. I do, however, need, in this
particular and rare instance, to keep track of the whereabouts of the
mouse **only** while that little window is open for a few seconds.
Until then, this solution meets my needs and at a minimum of cpu
overhead (given the fact that I'm polling of course).
Thanks.
- Chase
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden