Michal Kohutek

Merging many rarely active threads into one

It often happens that a program needs to run a lot of short functions periodically, with various periods. An easy way to do it is to create a thread for each that performs the function and sleeps the rest of the time. This approach, however, doesn’t scale well. Here is an efficient and relatively simple solution to the problem in C++.