diff options
author | Todd Vierling <tv@duh.org> | 2014-05-23 11:17:49 -0400 |
---|---|---|
committer | Todd Vierling <tv@duh.org> | 2014-06-03 09:52:57 -0400 |
commit | 0d5fa2ab0e33bc2f27cf6e7b4943121aa08f1cb0 (patch) | |
tree | 6bec7465e4f74b83600206c917a01477dcf07af3 /src/library/scala/concurrent/SyncVar.scala | |
parent | b24e7573a17332606d9f9da49a397e02abec1b63 (diff) | |
download | scala-0d5fa2ab0e33bc2f27cf6e7b4943121aa08f1cb0.tar.gz scala-0d5fa2ab0e33bc2f27cf6e7b4943121aa08f1cb0.tar.bz2 scala-0d5fa2ab0e33bc2f27cf6e7b4943121aa08f1cb0.zip |
Add documentation to parts of scala.concurrent.
Diffstat (limited to 'src/library/scala/concurrent/SyncVar.scala')
-rw-r--r-- | src/library/scala/concurrent/SyncVar.scala | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/library/scala/concurrent/SyncVar.scala b/src/library/scala/concurrent/SyncVar.scala index d5dc3d7e3f..494c955833 100644 --- a/src/library/scala/concurrent/SyncVar.scala +++ b/src/library/scala/concurrent/SyncVar.scala @@ -13,6 +13,7 @@ import java.util.concurrent.TimeUnit /** A class to provide safe concurrent access to a mutable cell. * All methods are synchronized. * + * @tparam A type of the contained value * @author Martin Odersky * @version 1.0, 10/03/2003 */ @@ -20,6 +21,12 @@ class SyncVar[A] { private var isDefined: Boolean = false private var value: Option[A] = None + /** + * Waits for this SyncVar to become defined and returns + * the result, without modifying the stored value. + * + * @return value that is held in this container + */ def get: A = synchronized { while (!isDefined) wait() value.get @@ -57,8 +64,12 @@ class SyncVar[A] { value } - /** Waits for this SyncVar to become defined and returns - * the result */ + /** + * Waits for this SyncVar to become defined and returns + * the result, unsetting the stored value before returning. + * + * @return value that was held in this container + */ def take(): A = synchronized { try get finally unsetVal() @@ -129,4 +140,3 @@ class SyncVar[A] { } } - |