cplusplus.com cplusplus.com
cplusplus.com   C++ : Forums : Beginners : To call a function repeatedly after cert...
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Forums
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programm...
Articles
Lounge
Jobs

-

post  To call a function repeatedly after certain period

babu198649 (16)
hi
I need to call a function repeatedly after some fixed time(100 milli seconds).
Which header files and classes should be used to do this.
|
mikeb570 (186)
sleep(milliseconds) and i think its in the standard library
|
Zaita (1576)
Sleep does work, but it's not guaranteed to be 100% accurate :)
|
jsmith (958)
Neither sleep() nor any other user timing function can be 100% accurate for 2 reasons:
1) The system clock source may not provide enough granularity (unlikely in this case);
2) The process is at the mercy of the operating system to schedule it and run it when
the sleep interval expires.

#2 is why all POSIX timing functions make the weak guarantee that your process is guaranteed to sleep for at least the given amount of time, possible more or even infinite.

The best you can do short of writing kernel code is to set the process priority to the highest possible setting to minimize scheduling latency (#2).
|

This topic is archived - New replies not allowed.
Home page | Privacy policy
© cplusplus.com, 2000-2009 - All rights reserved - v2.2
Spotted an error? contact us