It’s not clear to me how to implement the dispatch thread. The thread must be woken up when
- timer is expired
- the new thread is added and ends up being the top of the heap.
I guess we need some combination of this_thread::sleep_for() + condition_variable::wait(). Can someone enlighten me how to do this?
Appreciated any pointer.