top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between sleep and usleep in C, please explain with example?

+1 vote
1,265 views
What is the difference between sleep and usleep in C, please explain with example?
posted Jul 27, 2015 by Tapesh Kulkarni

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The usleep() function suspends execution of the calling thread for (at least) usec microseconds. The sleep may be lengthened slightly by any system activity or by the time spent processing the call or by the granularity of system timers. while sleep is delaying the execution of a task(could be a thread or anything) for sometime .

For usleep(): http://linux.die.net/man/3/usleep
For sleep() : http://linux.die.net/man/1/sleep

answer Jul 28, 2015 by Amit Kumar Pandey
...