Removing Utils directory to better match namespaces

This commit is contained in:
Chris Cameron
2017-07-06 10:57:04 -04:00
parent c56d9fce3b
commit ac6ca84a8a
68 changed files with 65 additions and 65 deletions

View File

@@ -0,0 +1,49 @@
using System;
namespace ICD.Common.Utils
{
public sealed partial class SafeCriticalSection
{
/// <summary>
/// Enters the critical section, executes the callback and leaves the section.
/// </summary>
/// <param name="callback"></param>
public void Execute(Action callback)
{
if (callback == null)
throw new ArgumentNullException("callback");
try
{
Enter();
callback();
}
finally
{
Leave();
}
}
/// <summary>
/// Enters the critical section, executes the callback and leaves the section.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="callback"></param>
/// <returns></returns>
public T Execute<T>(Func<T> callback)
{
if (callback == null)
throw new ArgumentNullException("callback");
try
{
Enter();
return callback();
}
finally
{
Leave();
}
}
}
}