• 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
Stopwatch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stopwatch


  • Subject: Stopwatch
  • From: Sanri Parov <email@hidden>
  • Date: Sun, 12 Jun 2005 19:59:47 +0200

Hi everybody,

I'm building a stopwatch for my app and I need to start a new thread
for the counting job.
Now, I've managed to fire up a new thread... but I don't know how to
stop it when the user press
a particular button.


------------------------------------------------------------------
- (IBAction)timerStartStop:(id)sender
{
    if (timerStatus==NO)
		thread =[NSThread detachNewThreadSelector:@selector(timer)
toTarget:self withObject:nil];
    else
    		thread=[NSThread exit];
}

-(void) timer
{
    NSTimeInterval intervallo;
    date = [NSDate date];
    for(;;)
    {
	intervallo = [date timeIntervalSinceNow];
	NSLog(@"%f",intervallo);
    }
}
------------------------------------------------------------------

Quite obviously the app doesn't know what to kill and then... suicide
itself.
Can you please help me ?
Thanks.

--
Sanri Parov
 _______________________________________________
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

  • Follow-Ups:
    • Re: Stopwatch
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Stumped on paint bucket in Core Image and polygons in Quartz
  • Next by Date: Re: Stopwatch
  • Previous by thread: Trouble with Services
  • Next by thread: Re: Stopwatch
  • Index(es):
    • Date
    • Thread