Parameters
- item
Library/Library.Test/TestObjectKeepAlive.cs
C# | Copy Code |
---|---|
TimeSpan timeout = TimeSpan.FromMilliseconds(25); ObjectKeepAlive keep = new ObjectKeepAlive(100, 10000, timeout); for (int i = 0; i < 100000; i++) keep.Add(i); System.Threading.Thread.Sleep(timeout); for (int i = 0; i < 10000; i++) keep.Add(i); |
VB.NET | Copy Code |
---|---|
Dim timeout As TimeSpan = TimeSpan.FromMilliseconds(25) Dim keep As New ObjectKeepAlive(100, 10000, timeout) Dim i As Integer = 0 While i < 100000 keep.Add(i) System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1) End While System.Threading.Thread.Sleep(timeout) Dim i As Integer = 0 While i < 10000 keep.Add(i) System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1) End While |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7