• 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: How to provide idle time in Cocoa/Objective-C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >How to provide idle time in Cocoa/Objective-C? (From: "Partha" <email@hidden>)

  • Prev by Date: Cocoa Help Implementation
  • Next by Date: Open -a parameters
  • Previous by thread: How to provide idle time in Cocoa/Objective-C?
  • Next by thread: Cocoa Help Implementation
  • Index(es):
    • Date
    • Thread