< prev index next >

src/java.base/share/classes/java/lang/Object.java

Print this page
rev 50306 : imported patch loom-fibers

@@ -347,11 +347,23 @@
      * @see    #notify()
      * @see    #notifyAll()
      * @see    #wait()
      * @see    #wait(long, int)
      */
-    public final native void wait(long timeout) throws InterruptedException;
+    public final void wait(long timeout) throws InterruptedException {
+        try {
+            wait0(timeout);
+        } catch (InterruptedException e) {
+            Thread t = Thread.currentThread();
+            if (t instanceof Fiber)
+                t.getAndClearInterrupt();
+            throw e;
+        }
+    }
+
+    // final modifier so method not in vtable
+    private final native void wait0(long timeout) throws InterruptedException;
 
     /**
      * Causes the current thread to wait until it is awakened, typically
      * by being <em>notified</em> or <em>interrupted</em>, or until a
      * certain amount of real time has elapsed.
< prev index next >