SDRSharper/SDRSharper.Radio/SDRSharp.Radio/DSPThreadPool.cs
SDRSharpR c07e6e6034 SDRSharper (SDRSharp Remake) Full Source (VS2017)
SDRSharper (SDRSharp Remake) Full Source (VS2017)
2018-03-26 14:02:05 -07:00

53 lines
1.1 KiB
C#

using System.Threading;
namespace SDRSharp.Radio
{
public static class DSPThreadPool
{
private static SharpThreadPool _threadPool;
public static void Initialize()
{
if (DSPThreadPool._threadPool == null)
{
DSPThreadPool._threadPool = new SharpThreadPool();
}
}
public static void Initialize(int threadCount)
{
if (DSPThreadPool._threadPool == null)
{
DSPThreadPool._threadPool = new SharpThreadPool(threadCount);
}
}
public static void QueueUserWorkItem(WaitCallback callback)
{
if (DSPThreadPool._threadPool == null)
{
DSPThreadPool._threadPool = new SharpThreadPool();
}
DSPThreadPool._threadPool.QueueUserWorkItem(callback);
}
public static void QueueUserWorkItem(WaitCallback callback, object parameter)
{
if (DSPThreadPool._threadPool == null)
{
DSPThreadPool._threadPool = new SharpThreadPool();
}
DSPThreadPool._threadPool.QueueUserWorkItem(callback, parameter);
}
public static void Terminate()
{
if (DSPThreadPool._threadPool != null)
{
DSPThreadPool._threadPool.Dispose();
DSPThreadPool._threadPool = null;
}
}
}
}