简体   繁体   中英

Delay() in CarbonCore/OSUtils.h deprecated in mac os x 10.8

The CarbonCore/OSUtils.h has been deprecated in Mac OS X 10.8. I was using the Delay() from it. Now, I need to replace with Cocoa equivalent. I think [[NSRunLoop currentRunLoop] runUntilDate:] can be a replacement. Please suggest what would be the best replacement for the same. Thanks a lot.

I am simply using Delay() for making half-a-second delay.

The equivalent would be the usleep function, declared in unistd.h .

Delay suspends a thread. A run loop is not needed if you don't need to handle events on that thread in the meantime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM