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

Re: NSThread sleepUntilDate


  • Subject: Re: NSThread sleepUntilDate
  • From: Daniel Todd Currie <email@hidden>
  • Date: Sat, 10 Jul 2004 10:52:02 -0700

Yes, but if I am not mistaken, this will also stall your app if -sleepUntilDate: is called in the main thread. I would personally recommend using an NSTimer.

-- DTC


On 2004 Jul 10, at 10:02, David Blanton wrote:

Given this description of NSThread:


An NSThread object controls a thread of execution. Use NSThread when you
want to have an Objective-C method run in its own thread of execution or if
you need to terminate or delay the current thread.


I want to do some stuff then wait for an interval (20 seconds) before doing
the next instruction. Is sleepUntilDate the way to do this? In the old Mac
days you could use delay(...) at some point in the code. This is the
behavior for which I am looking.

NSDate * d = [NSDate dateWithTimeIntervalSinceNow:20]
NSThread * t = [NSThread currentThread];
[t sleepUntilDate:d]

// should this code wait here for 20 seconds before doing the next
//instruction?
_______________________________________________
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.
_______________________________________________
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.


  • Follow-Ups:
    • Re: NSThread sleepUntilDate
      • From: David Blanton <email@hidden>
References: 
 >NSThread sleepUntilDate (From: David Blanton <email@hidden>)

  • Prev by Date: Re: Compositing Tricks?
  • Next by Date: Re: Compositing Tricks?
  • Previous by thread: NSThread sleepUntilDate
  • Next by thread: Re: NSThread sleepUntilDate
  • Index(es):
    • Date
    • Thread