daily update on 20241002 by nitload youmu, intrinsic function rebuild, syntax style arrange
This commit is contained in:
@@ -39,54 +39,51 @@ namespace StgSharp.Timing
|
||||
public abstract class TimeSourceProviderBase
|
||||
{
|
||||
|
||||
private SemaphoreSlim _addSubscriberSemaphore = new SemaphoreSlim(1, 1);
|
||||
private SemaphoreSlim _addSubscriberSemaphore = new SemaphoreSlim(
|
||||
1, 1 );
|
||||
|
||||
protected SemaphoreSlim CheckSubscriberSemaphore
|
||||
{
|
||||
get => _addSubscriberSemaphore;
|
||||
}
|
||||
|
||||
public void AddSubscriber(TimeSpanProvider subscriber)
|
||||
public void AddSubscriber( TimeSpanProvider subscriber )
|
||||
{
|
||||
_addSubscriberSemaphore.Wait();
|
||||
try
|
||||
{
|
||||
AddSubscriberUnsynced(subscriber);
|
||||
try {
|
||||
_addSubscriberSemaphore.Wait();
|
||||
AddSubscriberUnsynced( subscriber );
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
finally {
|
||||
_addSubscriberSemaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveSubscriber(TimeSpanProvider subscriber)
|
||||
public void RemoveSubscriber( TimeSpanProvider subscriber )
|
||||
{
|
||||
_addSubscriberSemaphore.Wait();
|
||||
try
|
||||
{
|
||||
RemoveSubscriberUnsynced(subscriber);
|
||||
try {
|
||||
RemoveSubscriberUnsynced( subscriber );
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
catch( Exception ) {
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
finally {
|
||||
_addSubscriberSemaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void StartProvidingTime();
|
||||
|
||||
public abstract void StopProvidingTime();
|
||||
|
||||
protected abstract void AddSubscriberUnsynced(
|
||||
TimeSpanProvider subscriber );
|
||||
|
||||
protected abstract void AddSubscriberUnsynced(TimeSpanProvider subscriber);
|
||||
protected abstract void RemoveSubscriberUnsynced(TimeSpanProvider subscriber);
|
||||
protected abstract void RemoveSubscriberUnsynced(
|
||||
TimeSpanProvider subscriber );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user