Sleep in Cocoa?

I don’t know why, but the statistics of this blog says that there are lots lof people who have interest in sleep function in Cocoa. Probably a same guy keeps visiting my blog for this.

Well, I don’t know what is so special about sleep.

Mac OS X is UNIX. So, you can use any standard library functions like sleep(), usleep() and nanosleep(). Also, NSThread provides Cocoa-level sleep facility.

5 responses to this post.

  1. iPhone sleep usleep sleepForTimeInterval NSTimer…

    3 Möglichkeiten eine iPhone Anwendung zu pausieren:
    [NSThread sleepForTimeInterval:5];
    sleep(5);
    usleep(5000000);
    Alle 3 Anweisungen bewirken das gleiche Ergebniss, die Anwenudng wird schlafen gelegt. nachteil aller Optionen: die Anwendung wird wirklic…

    Reply

  2. Posted by Arthur Dent on August 26, 2010 at 11:01 PM

    I’m actually interested in knowing how eating cocoa affects sleep, not about the sleep function in Cocoa. Seriously. :)

    Reply

    • Posted by jongampark on August 27, 2010 at 7:30 AM

      Whatever the effect is, just avoid eating it before going to bed without brushing your teeth. :)

      Reply

  3. Funny one.:)

    Reply

  4. Posted by gosha on February 19, 2011 at 7:18 AM

    haha, thanks ;)

    Reply

Leave a comment