[fix time]time service now stopps properly

This commit is contained in:
Youmu Liu
2025-12-09 09:33:11 +08:00
parent f960982bd3
commit 6acc8629b8
5 changed files with 16 additions and 19 deletions
@@ -88,7 +88,7 @@ namespace StgSharp.Timing
// mark provider as ended so external users can observe terminal state
Volatile.Write(ref _endedFlag, 1);
s_unusedID.Push(TokenID);
_event.Dispose();
_event.Set();
GC.SuppressFinalize(this);
}
@@ -111,7 +111,9 @@ namespace StgSharp.Timing
while (true)
{
int cur = Volatile.Read(ref _pendingSpans);
if (cur == 0) {
if (cur == 0)
{
_event.Dispose();
return;
}
@@ -207,7 +209,8 @@ namespace StgSharp.Timing
{
// mark ended due to sequence timeout, then dispose
Volatile.Write(ref _endedFlag, 1);
Console.WriteLine("Time span ended.");
// Console.WriteLine("Time span ended.");
Dispose();
return false;
}