The function code is as follows:
/*
* Execution of the current suspend thread
*/
Int threadsleep (time_t sec, long nsec)
{
Struct timespec req, REM;
// Set the length of time for suspend
Req. TV _sec = (time_t) sec;
Req. TV _nsec = (long) nsec;
//
Sleep () and nanosleep () wake up the process after a period of sleep, but the implementation of the two is completely different.
Sleep in user programs:
Sleep ()Usleep ()Nanosleep ()
Sleep () and nanosleep () wake up the process after a period of
Sleep () and Nanosleep () are awakened after a process sleeps for a period of time, but the two implementations are completely different
Sleep in user programs:
Sleep ()Usleep ()Nanosleep ()
Sleep () and Nanosleep () are awakened after a
ArticleDirectory
Latency using I/O Ports
Latency using a combination of languages
Linux accurate time sequence (sleep, usleep, nanosleep)
11:36:48| Category:Linux| Tag:None |Font Size Subscription
First of all, I
Nanosleep () causes the process to go to sleep, specifying the time to wake the process, and sleep () based on its implementation
asmlinkage long sys_nanosleep(struct timespec *rqtp, struct timespec
1. usleep is inaccurate on different hardware platforms, for example, usleep (2*1000). The result is sleep for 10 ms. Is it too much? The test code is as follows:
#include #include int main(int argc,char **argv){ struct timeval oldTime, newTime;
First of all, I would like to thank the following two blogs for putting me out of a major misunderstanding:
Http://www.cppblog.com/kongque/archive/2011/01/18/138765.aspx
Http://blog.csdn.net/zjwoody/article/details/7882240
In one of my projects,
Reprint Please specify Source: http://blog.csdn.net/luotuo44/article/details/39374759This article mainly deals with Linux time types, time functions, and sleep functions provided by Linux.the time type and the corresponding function:time_t:The most
In the programming process, timing and latency are more or less required. There are several Timing/latency mechanisms in VxWorks. Based on the collected data and relevant documents of VxWorks, based on the learning and hands-on experiments, I would
1 taskdelayTaskdelay () provides a simple task sleep mechanism, which is also commonly used in applications that require a timing/latency mechanism.
The format is status taskdelay (INT ticks/* Number of ticks to delay task */),
We can see that the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.