Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alternative for sleep function

Tags:

sleep

iphone

I have implemented following in my application.

for(i=0;!stopThroughButtons && i<totalMovements;i++){
        [NSThread detachNewThreadSelector:@selector(moveNeedle) toTarget:self withObject:nil];
        sleep(0.3);
    }

Here the sleep is a function with argument of unsigned int type.

Sleep method uses seconds to sleep.

I want to give the timing in milliseconds to sleep.

Which best alternate is available?

like image 924
Sagar Kothari Avatar asked Sep 23 '09 18:09

Sagar Kothari


People also ask

What are the best alternative treatments for insomnia?

Sleep hypnosis, aromatherapy, herbs, and yoga are the most effective alternative treatments for sleep disorders like insomnia. Other treatments are effective but may take longer to work, depending on how severe your symptoms are. Herbal tea or an aromatherapy session may have instant effects, helping you fall asleep faster after the first use.

Is there an alternative to sleep () in MT4 that can be tested?

Alternative to Sleep () function in MT4 that can be tested? Is there an alternative to the Sleep () code in MT4 that can be used for testing in the Strategy Tester? According to MT4 documentation, Sleep () function does not suspend execution of the Expert Advisor in the Strategy Tester.

Can severe sleep disorders be treated without medication?

Severe sleep disorders may be more difficult to treat without medication. Alternative treatments can help treat sleep disorders, but the process may take longer than if you were to use medication. You can achieve better results by combining some of these treatments. Which Alternative Treatment is the Most Effective for Sleep Disorders?

Can emulators skip over sleep commands?

It is possible for emulators to skip over sleep commands called using the Sleep API. Therefore, alternative methods prove useful in ensuring that your commands are not skipped; for application stability as well as security. The advantages and disadvantages of each method are discussed. 1. Delay.


1 Answers

Two options:
int usleep(useconds_t useconds) will use microseconds
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) will use nanoseconds

like image 199
crashmstr Avatar answered Sep 30 '22 13:09

crashmstr