Weitere UnitTests
This commit is contained in:
@@ -22,7 +22,7 @@ namespace AMWD.Common.Utilities
|
||||
/// <summary>
|
||||
/// The synchronisation object.
|
||||
/// </summary>
|
||||
protected readonly object syncObj = new();
|
||||
protected readonly object syncLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// The exception handler.
|
||||
@@ -122,7 +122,7 @@ namespace AMWD.Common.Utilities
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
if (!IsWaitingToRun && !IsRunning)
|
||||
{
|
||||
@@ -149,7 +149,7 @@ namespace AMWD.Common.Utilities
|
||||
public void Cancel()
|
||||
{
|
||||
TaskCompletionSourceWrapper localTcs = null;
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
IsWaitingToRun = false;
|
||||
nextRunPending = false;
|
||||
@@ -172,7 +172,7 @@ namespace AMWD.Common.Utilities
|
||||
/// <returns><c>true</c>, if an execution was started; otherwise, <c>false</c>.</returns>
|
||||
public bool ExecutePending()
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
if (!IsWaitingToRun && !IsRunning)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ namespace AMWD.Common.Utilities
|
||||
/// <returns>An awaiter instance.</returns>
|
||||
public TaskAwaiter GetAwaiter()
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
return tcs.Task.GetAwaiter();
|
||||
}
|
||||
@@ -211,7 +211,7 @@ namespace AMWD.Common.Utilities
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
return tcs.Task;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ namespace AMWD.Common.Utilities
|
||||
/// <param name="state">Unused.</param>
|
||||
protected void OnTimerCallback(object state)
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
if (!IsWaitingToRun)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ namespace AMWD.Common.Utilities
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
runAgain = false;
|
||||
IsRunning = false;
|
||||
@@ -320,7 +320,7 @@ namespace AMWD.Common.Utilities
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
runAgain = nextRunPending;
|
||||
IsRunning = runAgain;
|
||||
@@ -484,7 +484,7 @@ namespace AMWD.Common.Utilities
|
||||
/// <returns>An awaiter instance.</returns>
|
||||
public new TaskAwaiter<TResult> GetAwaiter()
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
var myTcs = (TaskCompletionSourceWrapper<TResult>)tcs;
|
||||
var myTask = (Task<TResult>)myTcs.Task;
|
||||
@@ -499,7 +499,7 @@ namespace AMWD.Common.Utilities
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (syncObj)
|
||||
lock (syncLock)
|
||||
{
|
||||
var myTcs = (TaskCompletionSourceWrapper<TResult>)tcs;
|
||||
var myTask = (Task<TResult>)myTcs.Task;
|
||||
|
||||
Reference in New Issue
Block a user