• 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: updating UI during long loop using cocoa objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: updating UI during long loop using cocoa objective-c


  • Subject: Re: updating UI during long loop using cocoa objective-c
  • From: Bob Smith <email@hidden>
  • Date: Sun, 1 Apr 2007 23:53:12 -0700


On Mar 31, 2007, at 9:54 PM, Jerry Krinock wrote:

If the only UI you need to be active is one window, the modal session will theoretically get you there with much less code and bugs than multithreading. (Of course, it is multithreading under the hood, but Apple has done all the hard parts for you.)

Actually a modal session stays in one thread. The -runModalSession method is a call-back into the application's run loop, by sending that you are keeping the run loop going so redraws, event handling, timers, etc. all continue to operate; but this is just the normal appkit run loop behavior, not multi-threading.


I've used a modal session with a simple window that has a progress bar and a Cancel button. I guess it should work with a table, but that might be pushing the envelope.

It should work fine with anything. Event handling is restricted to the window you specify when you create the session, but all windows will redraw as needed during the -runModalSession call, just as with any normal pass through the run loop.


However one thing -runModalSession does not do is autoreleasing, so your modal session code might need to manage it's own autorelease pools.

Bob S.



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: updating UI during long loop using cocoa objective-c
      • From: Scott Ribe <email@hidden>
    • Re: updating UI during long loop using cocoa objective-c
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: error displaying @count via bindings
  • Next by Date: Deselecting an NSButtonCell?
  • Previous by thread: Re: error displaying @count via bindings
  • Next by thread: Re: updating UI during long loop using cocoa objective-c
  • Index(es):
    • Date
    • Thread