• 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: Secondary run loops?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Secondary run loops?


  • Subject: Re: Secondary run loops?
  • From: Andrei Tchijov <email@hidden>
  • Date: Thu, 10 Aug 2006 00:08:22 -0400

If you choose to create separate thread, do not forget to allocate NSAutoreleasePool at the beginning (and release it at the end )

On Aug 10, 2006, at 12:03 AM, Chris Suter wrote:


On 10/08/2006, at 1:48 PM, Andrei Tchijov wrote:

calling
[[ NSRunLoop currentLoop ] runUntilDate: [ NSDate dateWithTimeIntervalSinceNow: 1.0 ]]
in place of WaitNextEvent() might help

You should be aware that doing things this way might mean that whatever you're doing could get interrupted for a time if the user can do things that take a while. For example, many things process their own events whilst the mouse is down. Or you might have an application modal dialog that gets displayed which again processes events outside of your control. You'd also obviously want to avoid recursion. The other thing to be wary of with the approach is that you need to process the run loop sufficiently fast that the user interface still seems responsive; calling the method above every, say, 10 loops might work well on your machine but not on a slower machine.


Using a separate thread to do the work you need avoids these problems, although is arguably more complicated to implement.

The other option is to use the application modal stuff. See beginModalSessionForWindow: in NSApplication.

- Chris





_______________________________________________ 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
References: 
 >Secondary run loops? (From: Mark Dawson <email@hidden>)
 >Re: Secondary run loops? (From: Andrei Tchijov <email@hidden>)
 >Re: Secondary run loops? (From: Chris Suter <email@hidden>)

  • Prev by Date: Re: Secondary run loops?
  • Next by Date: For Correct Redo Action Name: Undo Method must be Dedicated?
  • Previous by thread: Re: Secondary run loops?
  • Next by thread: Re: Secondary run loops?
  • Index(es):
    • Date
    • Thread