|
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace MultiThreadQueueLib
{
public class CancellationToken : IDisposable
{
/// <summary>
/// The event for cancellation.
/// </summary>
private ManualResetEvent cancelEvent = new ManualResetEvent(false);
public ManualResetEvent Token
{
get
{
return cancelEvent;
}
}
public void Cancel()
{
cancelEvent.Set();
}
public void Reset()
{
cancelEvent.Reset();
}
public void Dispose()
{
if (cancelEvent != null)
{
cancelEvent.Close();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I’m an IT Project Manager for an Italian Betting Company and over the last 2 years I acquired experience in Betting area.
I have developed code in different object oriented languages (C#, C++, Java) for more than 10 years using a set of technology such as .Net, J2EE, multithreading, etc…