summaryrefslogtreecommitdiffstats
path: root/libart
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2014-02-12 13:04:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-12 13:04:32 +0000
commit6bac5b7930878c03d773451005ac09b2e9fd4251 (patch)
tree89af441fbd2efac9fb60348a0586713e92b48017 /libart
parent28261e443646049e8278ee0b64a2df9aa50f3b43 (diff)
parent23122dc6c511936935ceaccaed94adafdc9fddaf (diff)
downloadlibcore-6bac5b7930878c03d773451005ac09b2e9fd4251.tar.gz
libcore-6bac5b7930878c03d773451005ac09b2e9fd4251.tar.bz2
libcore-6bac5b7930878c03d773451005ac09b2e9fd4251.zip
Merge "Add documentation around zero-length timeouts"
Diffstat (limited to 'libart')
-rw-r--r--libart/src/main/java/java/lang/Object.java73
-rw-r--r--libart/src/main/java/java/lang/Thread.java31
2 files changed, 56 insertions, 48 deletions
diff --git a/libart/src/main/java/java/lang/Object.java b/libart/src/main/java/java/lang/Object.java
index 9c59870f1..81e3872f8 100644
--- a/libart/src/main/java/java/lang/Object.java
+++ b/libart/src/main/java/java/lang/Object.java
@@ -278,10 +278,9 @@ public class Object {
* that called {@code notify()} has to release the object's monitor first.
* Also, the chosen thread still has to compete against other threads that
* try to synchronize on the same object.
- * <p>
- * This method can only be invoked by a thread which owns this object's
+ *
+ * <p>This method can only be invoked by a thread which owns this object's
* monitor. A thread becomes owner of an object's monitor
- * </p>
* <ul>
* <li>by executing a synchronized method of that object;</li>
* <li>by executing the body of a {@code synchronized} statement that
@@ -304,10 +303,9 @@ public class Object {
* will not run immediately. The thread that called {@code notify()} has to
* release the object's monitor first. Also, the threads still have to
* compete against other threads that try to synchronize on the same object.
- * <p>
- * This method can only be invoked by a thread which owns this object's
+ *
+ * <p>This method can only be invoked by a thread which owns this object's
* monitor. A thread becomes owner of an object's monitor
- * </p>
* <ul>
* <li>by executing a synchronized method of that object;</li>
* <li>by executing the body of a {@code synchronized} statement that
@@ -349,23 +347,22 @@ public class Object {
* notify()} or {@code notifyAll()} method of this object. This method can
* only be invoked by a thread which owns this object's monitor; see
* {@link #notify()} on how a thread can become the owner of a monitor.
- * <p>
- * A waiting thread can be sent {@code interrupt()} to cause it to
+ *
+ * <p>A waiting thread can be sent {@code interrupt()} to cause it to
* prematurely stop waiting, so {@code wait} should be called in a loop to
* check that the condition that has been waited for has been met before
* continuing.
- * </p>
- * <p>
- * While the thread waits, it gives up ownership of this object's monitor.
- * When it is notified (or interrupted), it re-acquires the monitor before
- * it starts running.
- * </p>
+ *
+ * <p>While the thread waits, it gives up ownership of this object's
+ * monitor. When it is notified (or interrupted), it re-acquires the monitor
+ * before it starts running.
*
* @throws IllegalMonitorStateException
* if the thread calling this method is not the owner of this
* object's monitor.
- * @throws InterruptedException
- * if another thread interrupts this thread while it is waiting.
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception
+ * is thrown.
* @see #notify
* @see #notifyAll
* @see #wait(long)
@@ -380,17 +377,18 @@ public class Object {
* specified timeout expires. This method can only be invoked by a thread
* which owns this object's monitor; see {@link #notify()} on how a thread
* can become the owner of a monitor.
- * <p>
- * A waiting thread can be sent {@code interrupt()} to cause it to
+ *
+ * <p>A waiting thread can be sent {@code interrupt()} to cause it to
* prematurely stop waiting, so {@code wait} should be called in a loop to
* check that the condition that has been waited for has been met before
* continuing.
- * </p>
- * <p>
- * While the thread waits, it gives up ownership of this object's monitor.
- * When it is notified (or interrupted), it re-acquires the monitor before
- * it starts running.
- * </p>
+ *
+ * <p>While the thread waits, it gives up ownership of this object's
+ * monitor. When it is notified (or interrupted), it re-acquires the monitor
+ * before it starts running.
+ *
+ * <p>A timeout of zero means the calling thread should wait forever unless interrupted or
+ * notified.
*
* @param millis
* the maximum time to wait in milliseconds.
@@ -399,8 +397,9 @@ public class Object {
* @throws IllegalMonitorStateException
* if the thread calling this method is not the owner of this
* object's monitor.
- * @throws InterruptedException
- * if another thread interrupts this thread while it is waiting.
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception
+ * is thrown.
* @see #notify
* @see #notifyAll
* @see #wait()
@@ -417,17 +416,18 @@ public class Object {
* specified timeout expires. This method can only be invoked by a thread
* that owns this object's monitor; see {@link #notify()} on how a thread
* can become the owner of a monitor.
- * <p>
- * A waiting thread can be sent {@code interrupt()} to cause it to
+ *
+ * <p>A waiting thread can be sent {@code interrupt()} to cause it to
* prematurely stop waiting, so {@code wait} should be called in a loop to
* check that the condition that has been waited for has been met before
* continuing.
- * </p>
- * <p>
- * While the thread waits, it gives up ownership of this object's monitor.
- * When it is notified (or interrupted), it re-acquires the monitor before
- * it starts running.
- * </p>
+ *
+ * <p>While the thread waits, it gives up ownership of this object's
+ * monitor. When it is notified (or interrupted), it re-acquires the monitor
+ * before it starts running.
+ *
+ * <p>A timeout of zero means the calling thread should wait forever unless interrupted or
+ * notified.
*
* @param millis
* the maximum time to wait in milliseconds.
@@ -440,8 +440,9 @@ public class Object {
* @throws IllegalMonitorStateException
* if the thread calling this method is not the owner of this
* object's monitor.
- * @throws InterruptedException
- * if another thread interrupts this thread while it is waiting.
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception
+ * is thrown.
* @see #notify
* @see #notifyAll
* @see #wait()
diff --git a/libart/src/main/java/java/lang/Thread.java b/libart/src/main/java/java/lang/Thread.java
index b826e66b7..852e2cf1f 100644
--- a/libart/src/main/java/java/lang/Thread.java
+++ b/libart/src/main/java/java/lang/Thread.java
@@ -712,8 +712,9 @@ public class Thread implements Runnable {
* Blocks the current Thread (<code>Thread.currentThread()</code>) until
* the receiver finishes its execution and dies.
*
- * @throws InterruptedException if <code>interrupt()</code> was called for
- * the receiver while it was in the <code>join()</code> call
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception is
+ * thrown.
* @see Object#notifyAll
* @see java.lang.ThreadDeath
*/
@@ -730,9 +731,12 @@ public class Thread implements Runnable {
* the receiver finishes its execution and dies or the specified timeout
* expires, whatever happens first.
*
+ * <p>A timeout of zero means the calling thread should wait forever unless interrupted.
+ *
* @param millis The maximum time to wait (in milliseconds).
- * @throws InterruptedException if <code>interrupt()</code> was called for
- * the receiver while it was in the <code>join()</code> call
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception is
+ * thrown.
* @see Object#notifyAll
* @see java.lang.ThreadDeath
*/
@@ -745,10 +749,13 @@ public class Thread implements Runnable {
* the receiver finishes its execution and dies or the specified timeout
* expires, whatever happens first.
*
+ * <p>A timeout of zero means the calling thread should wait forever unless interrupted.
+ *
* @param millis The maximum time to wait (in milliseconds).
* @param nanos Extra nanosecond precision
- * @throws InterruptedException if <code>interrupt()</code> was called for
- * the receiver while it was in the <code>join()</code> call
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception is
+ * thrown.
* @see Object#notifyAll
* @see java.lang.ThreadDeath
*/
@@ -969,9 +976,9 @@ public class Thread implements Runnable {
*
* @param time
* The time to sleep in milliseconds.
- * @throws InterruptedException
- * if <code>interrupt()</code> was called for this Thread while
- * it was sleeping
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception
+ * is thrown.
* @see Thread#interrupt()
*/
public static void sleep(long time) throws InterruptedException {
@@ -987,9 +994,9 @@ public class Thread implements Runnable {
* The time to sleep in milliseconds.
* @param nanos
* Extra nanosecond precision
- * @throws InterruptedException
- * if <code>interrupt()</code> was called for this Thread while
- * it was sleeping
+ * @throws InterruptedException if the current thread has been interrupted.
+ * The interrupted status of the current thread will be cleared before the exception
+ * is thrown.
* @see Thread#interrupt()
*/
public static void sleep(long millis, int nanos) throws InterruptedException {