Re: NSThread sleepUntilDate
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.