Re: How to check the number of pending events in the application event queue?
Re: How to check the number of pending events in the application event queue?
- Subject: Re: How to check the number of pending events in the application event queue?
- From: Peter Sagerson <email@hidden>
- Date: Mon, 27 Oct 2008 23:04:15 -0700
Since you can postpone the task midstride, then you might just want to
think of this in terms of breaking the task up into small pieces to be
interspersed with event handling.
- (void)doSomeMoreWork
{
[self doTheNextStep];
if([self isMoreWorkToDo])
[self performSelector:@selector(doSomeMoreWork)
withObject:nil afterDelay:0.0];
}
If your work units are small enough, you shouldn't really have to
worry about idleness.
On Oct 27, 2008, at 6:19 AM, Oleg Krupnov wrote:
Yes, I'd really like to avoid multi-threading. There would be an
intense data exchange between the threads and the effort for
synchronization would be simply not justified for such a tiny feature.
Actually I did try multi-threading before I arrived to this solution,
and I have spent very long and painful day debugging some weird
rare-happening synchronization bug. Besides, real multi-threaded task
works slightly different than simply postponed-to-idleness task. The
two threads may be running simultaneously even if the main thread has
a higher priority, whereas I'd prefer strict suspension of the
secondary task when the main thread wakes up.
On Mon, Oct 27, 2008 at 3:05 PM, Jean-Daniel Dupas
<email@hidden> wrote:
Le 27 oct. 08 à 13:54, Oleg Krupnov a écrit :
In my app I'd like to perform some background task without affecting
the responsiveness of the UI. To avoid multi-threading, I just
postpone the task to a moment when the user becomes and stays idle
for
a certain time.
Have you a good reason to avoid multi-threading ?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
@ignorare.net
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden