• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to check the number of pending events in the application event queue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How to check the number of pending events in the application event queue? (From: "Oleg Krupnov" <email@hidden>)
 >Re: How to check the number of pending events in the application event queue? (From: Jean-Daniel Dupas <email@hidden>)
 >Re: How to check the number of pending events in the application event queue? (From: "Oleg Krupnov" <email@hidden>)

  • Prev by Date: Re: Core Data Questions--Relationships, UUIDs, and Dirty States
  • Next by Date: Re: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
  • Previous by thread: Re: How to check the number of pending events in the application event queue?
  • Next by thread: IKImageBrowserView only horizontal scrolling
  • Index(es):
    • Date
    • Thread