Replies: 3 comments
-
|
I suspect the problem is here: if (oldTicks != newTicks)
{
// time changed while in the callback, readjust the wake time accordingly
candidate.WakeupTime = newTicks + candidate.Period;
}You are advancing time while the callback is executing, which results in the callback getting rescheduled to a later point, which then never happens. |
Beta Was this translation helpful? Give feedback.
-
|
@svick perhaps, but in that case - what is the proper way to use |
Beta Was this translation helpful? Give feedback.
-
|
In the remarks section in documentation of TimeProvider.CreateTimer it says:
IMO either FakeTimeProvider should be explicit in documentation or perhaps it should be fixed so that it is triggered when advancing time. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following abstraction of a
PeriodicTimer(simplified)Since it accepts
TimeProvideras a constructor parameter - i'm attempting to test it usingFakeTimeProviderin the following wayWhat i'm observing is that advancing fake time provider in between the ticks - doesn't seem to achieve anything (i.e. the second tick never happens).
Am i using the time provider wrong? There seem to be no other hook points (apart from in between the ticks) to advance the time. And if this is by design - what's the purpose of passing time provider to periodic timer in the first place?
I'm curious where i am mistaken here
Beta Was this translation helpful? Give feedback.
All reactions