c++ - implement waiting timer using only the standard library -


what standard c++ ways exist implement waiting timer? is, code trigger timer callback , , wait timeout occur (not waste any, or little, cpu cycles). there must finite number of ways std::. using <thread> , timeout feature of condition variables. seems wasteful have spawn thread each timer.

std::this_thread::sleep_for() , std::this_thread::sleep_until() useful unless you're spawning new thread, cannot other work @ same time.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -