Re: How to provide idle time in Cocoa/Objective-C?
Re: How to provide idle time in Cocoa/Objective-C?
- Subject: Re: How to provide idle time in Cocoa/Objective-C?
- From: Tom Sutcliffe <email@hidden>
- Date: Mon, 26 May 2003 14:08:37 +0100
You can use
sleep(numSeconds) (defined in unistd.h - standard c function)
or
[[NSThread currentThread] sleepUntilDate: [NSDate
dateWithTimeIntervalSinceNow: numSeconds]]
but both of these block the run loop, so you app will appear to freeze
for numSeconds. A better way might be
[NSTimer scheduledTimerWithTimeInterval: numSeconds target: self
selector: @selector(methodCall:) userInfo: nil repeats: NO]
which will call methodCall after numSeconds, and still allow the run
loop to respond in the mean time.
Regards,
Tom
On Monday, May 26, 2003, at 01:35 pm, Partha wrote:
Hi,
In my Cocoa/Objective-C application, I need to provide some idle time
to the
processor between two consecutive operations. Can anybody tell me what
is the
method for providing idle time in Cocoa/Objective-C?
TIA,
Partha
_______________________________________________
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.