CSharpTest.Net
WorkQueue Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Threading Namespace : WorkQueue Class

Glossary Item Box

An extremely basic WorkQueue using a fixed number of threads to execute Action() or Action<T> delegates

Syntax

Visual Basic (Declaration) 
Public Class WorkQueue 
   Inherits CSharpTest.Net.Threading.WorkQueue(Of Action)
   Implements CSharpTest.Net.Threading.IWorkQueue(Of Action) 

Example

Library/Library.Test/TestWorkQueue.cs

C#Copy Code
using (ManualResetEvent finished = new ManualResetEvent(false))
using (WorkQueue worker = new WorkQueue(2))
{
    worker.Enqueue(delegate() { finished.Set(); });
    Assert.IsTrue(finished.WaitOne(100, false));
}
VB.NETCopy Code
Using finished As New ManualResetEvent(False)
    Using worker As New WorkQueue(2)
        worker.Enqueue(Function() Do
            finished.[Set]()
        End Function)
        Assert.IsTrue(finished.WaitOne(100, False))
    End Using
End Using

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Threading.WorkQueue<T>
      CSharpTest.Net.Threading.WorkQueue

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys