I would appreciate some guidance on how to periodically wake up a C ++ 11 stream (say, every 100 ms). The platform is Linux and the C ++ language. I came across this solution:
C ++ 11: Periodically call a C ++ function
but there they call the callback function and then sleep for the timer interval. This means that the actual period is the execution time of the function + interval. I want to call a callback at a constant interval, regardless of how long it takes.
I wonder if Boost will help? But I would prefer not to use it, since this project is not multi-platform, and I want to minimize the use of third-party libraries.
Perhaps combining a POSIX timer with a C ++ stream is the way forward? I donβt know exactly how this will work.
Any suggestions on how to get started will be appreciated.
source share