You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/10/28 20:50:17 UTC
svn commit: r1028428 -
/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/CountDownLatch.cs
Author: tabish
Date: Thu Oct 28 18:50:17 2010
New Revision: 1028428
URL: http://svn.apache.org/viewvc?rev=1028428&view=rev
Log:
Adds an infinite await method for convenience. Also adds some API docs.
Modified:
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/CountDownLatch.cs
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/CountDownLatch.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/CountDownLatch.cs?rev=1028428&r1=1028427&r2=1028428&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/CountDownLatch.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/CountDownLatch.cs Thu Oct 28 18:50:17 2010
@@ -29,6 +29,9 @@ namespace Apache.NMS.Util
remaining = i;
}
+ /// <summary>
+ /// Decrement the count, releasing any waiting Threads when the count reaches Zero.
+ /// </summary>
public void countDown()
{
lock(mutex)
@@ -44,6 +47,9 @@ namespace Apache.NMS.Util
}
}
+ /// <summary>
+ /// Gets the current count for this Latch.
+ /// </summary>
public int Remaining
{
get
@@ -55,6 +61,19 @@ namespace Apache.NMS.Util
}
}
+ /// <summary>
+ /// Causes the current Thread to wait for the count to reach zero, unless
+ /// the Thread is interrupted.
+ /// </summary>
+ public void await()
+ {
+ this.await(TimeSpan.FromMilliseconds(Timeout.Infinite));
+ }
+
+ /// <summary>
+ /// Causes the current thread to wait until the latch has counted down to zero, unless
+ /// the thread is interrupted, or the specified waiting time elapses.
+ /// </summary>
public bool await(TimeSpan timeout)
{
return mutex.WaitOne((int) timeout.TotalMilliseconds, false);