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

nThreads

Glossary Item Box

Constructs the Work Queue with the specified number of threads.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal nThreads As Integer _
)
C# 
public WorkQueue( 
   int nThreads
)

Parameters

nThreads

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

Requirements

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

See Also

Reference

WorkQueue Class
WorkQueue Members

Used By

ThreadedBTreeTest.TestAtomicUpdate()
ThreadedBTreeTest.TestErrorsOnInsertAndDelete()
ThreadedBTreeTest.TestConcurrentCreateReadUpdateDelete8000()
Boolean SecureTransfer.Client.Upload(String,Int64,Stream)

Source Code

Library/Threading/WorkQueue.cs

Generated with Document! X 2011 by Innovasys