• 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: Basic thread example?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic thread example?


  • Subject: Re: Basic thread example?
  • From: Alastair Houghton <email@hidden>
  • Date: Sat, 28 Feb 2004 23:41:21 +0000

On 28 Feb 2004, at 01:20, email@hidden wrote:

does anyone know if there is one floating around, i don't want my users
to sit and go wtf is this thing doing anything so i want to make a
thread to perform my method and show its progress with a threaded
progress bar but i can't seem to find a basic example i've got this
code but i get mem leaks?

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
BOOL keepGoing = YES;

while( keepGoing )
{
do some stuff
}

keepGoing = NO;
[pool release];

Well for one thing, if you're changing keepGoing from another thread, you need to declare it volatile (otherwise the loop will never finish).

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Basic thread example? (From: email@hidden)

  • Prev by Date: Saving NSViews
  • Next by Date: Some voodoo curses app's launching, icon display
  • Previous by thread: Basic thread example?
  • Next by thread: very specialized event handling
  • Index(es):
    • Date
    • Thread