SmartThreadPool v1.0
This commit is contained in:
Ami Bar
2009-12-19 16:27:08 +02:00
parent 8d9c132b24
commit b30b4abdda
65 changed files with 11818 additions and 27 deletions
+35
View File
@@ -0,0 +1,35 @@
using Amib.Threading;
namespace Examples
{
public class SimpleExample
{
public void DoWork(object state)
{
SmartThreadPool smartThreadPool = new SmartThreadPool();
// Queue the work item
IWorkItemResult wir =
smartThreadPool.QueueWorkItem(
new WorkItemCallback(this.DoRealWork),
state);
// Do some other work here
// Get the result of the operation
object result = wir.Result;
smartThreadPool.Shutdown();
}
// Do the real work
private object DoRealWork(object state)
{
object result = null;
// Do the real work here and put the result in 'result'
return result;
}
}
}