mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-28 13:01:05 +03:00
v2.0
SmartThreadPool v2.0
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Amib.Threading;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace STPTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for TestCancel.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
[Category("TestFuncT")]
|
||||
public class TestFuncT
|
||||
{
|
||||
[Test]
|
||||
public void FuncT()
|
||||
{
|
||||
SmartThreadPool stp = new SmartThreadPool();
|
||||
IWorkItemResult<int> wir =
|
||||
stp.QueueWorkItem(new Func<int, int>(f), 1);
|
||||
|
||||
int y = wir.GetResult();
|
||||
|
||||
Assert.AreEqual(y, 2);
|
||||
|
||||
try
|
||||
{
|
||||
wir.GetResult();
|
||||
}
|
||||
finally
|
||||
{
|
||||
stp.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private int f(int x)
|
||||
{
|
||||
return x + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user