daily update on 20240325 by nitload youmu
This commit is contained in:
@@ -45,7 +45,7 @@ namespace StgSharp
|
||||
|
||||
internal static StgSharpTime mainTimeProvider;
|
||||
|
||||
internal static StgSharpTime MainTimeProvider=>mainTimeProvider;
|
||||
internal static StgSharpTime MainTimeProvider => mainTimeProvider;
|
||||
|
||||
}
|
||||
|
||||
@@ -92,6 +92,14 @@ namespace StgSharp
|
||||
timeProvideThread.Start();
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
{
|
||||
lock (mainProvider)
|
||||
{
|
||||
mainProvider.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override sealed void AddSubscriberUnsynced(TimeSpanProvider subscriber)
|
||||
{
|
||||
@@ -113,29 +121,28 @@ namespace StgSharp
|
||||
while (mainProvider.IsRunning)
|
||||
{
|
||||
totalMS = mainProvider.ElapsedTicks / (internalFrequncy / (1000L * 1000L));
|
||||
if (subscriberList.Count==0)
|
||||
if (subscriberList.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CheckSubscriberSemaphore.Wait();
|
||||
List<TimeSpanProvider> toRemoveList = new List<TimeSpanProvider>();
|
||||
foreach (TimeSpanProvider subscriber in subscriberList)
|
||||
{
|
||||
if (subscriber.CheckTime(totalMS))
|
||||
if (!subscriber.CheckTime(totalMS))
|
||||
{
|
||||
|
||||
toRemoveList.Add(subscriber);
|
||||
};
|
||||
}
|
||||
if (toRemoveList.Count != 0)
|
||||
{
|
||||
foreach (TimeSpanProvider subscriber in toRemoveList)
|
||||
{
|
||||
subscriberList.Remove(subscriber);
|
||||
}
|
||||
}
|
||||
CheckSubscriberSemaphore.Release();
|
||||
}
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
{
|
||||
lock (mainProvider)
|
||||
{
|
||||
mainProvider.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user