Hi guys, so I'm having this exercise in Stroustrup's book and I think its by far the most interesting one! You can check it out if you want - chapter 20, exercise 11.
Here's some part of it
...There should be a scheduler implementing a concept
of virtual time. Provide a function task::delay(long) that ‘‘consumes’’ virtual time....
I was looking at this virtual time thing but couldn't find much about it but in the meantime I found such interesting stuff as windows.h and there this Sleep(mseconds) function is available.
It would create a delay but its not really a "virtual time".
How do you guys think Stroustrup meant this virtual time to be implemented?
If he has not explained sleeping, timers or anything like that I think he might just mean you should simulate time. Maybe the delay function should not actually wait but just advance the clock so that when the function returns the "virtual time" has advanced x ticks.
Tnx for reply man! I don't think timers will actually be explained and sleep as well. So as far as I understood you're suggesting that my "virtual time" would be like variable int x that I would increment (or maybe in this case when I'm "consuming" it - decrement) lets say after each function call? It would take away all the fun for sure :D