Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > pause/wait in objective-c

pause/wait in objective-c
Thread Tools
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Aug 17, 2004, 09:12 AM
 
Does anyone know if there is a pause or wait function in objective-c? I can find nothing in the Hillegass Cocoa book...
     
Senior User
Join Date: Feb 2003
Location: USA
Status: Offline
Reply With Quote
Aug 17, 2004, 09:19 AM
 
Check out NSTimer, might fit your needs.
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Aug 17, 2004, 10:06 AM
 
Originally posted by techtrucker:
Check out NSTimer, might fit your needs.
I use NSTimer, it is not really what I need. I need something that will pause without huge cpu usage, ie no for loops.
     
qyn
Dedicated MacNNer
Join Date: Dec 2000
Location: sj ca
Status: Offline
Reply With Quote
Aug 17, 2004, 10:30 AM
 
You can use the standard C sleep function:

Code:
sleep(5); // sleep for 5 seconds
(In the terminal, type "man 3 sleep" for documentation.)

You can also use the slightly more complicated nanosleep() function ("man 2 nanosleep").
     
Professional Poster
Join Date: Sep 2000
Location: Texas
Status: Offline
Reply With Quote
Aug 17, 2004, 02:33 PM
 
doh! I forgot it was sleep... thanks!
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:09 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2