< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/newclass02/java.base/java/lang/Object.java

Print this page
*** 366,20 ***
       *             this exception is thrown.
       * @see        java.lang.Object#notify()
       * @see        java.lang.Object#notifyAll()
       */
      public final void wait(long timeoutMillis) throws InterruptedException {
!         long comp = Blocker.begin();
          try {
              wait0(timeoutMillis);
          } catch (InterruptedException e) {
!             Thread thread = Thread.currentThread();
!             if (thread.isVirtual())
-                 thread.getAndClearInterrupt();
              throw e;
          } finally {
!             Blocker.end(comp);
          }
      }
  
      /**
       * Causes current thread to wait until another thread invokes the
--- 366,25 ---
       *             this exception is thrown.
       * @see        java.lang.Object#notify()
       * @see        java.lang.Object#notifyAll()
       */
      public final void wait(long timeoutMillis) throws InterruptedException {
!         if (!Thread.currentThread().isVirtual()) {
+             wait0(timeoutMillis);
+             return;
+         }
+ 
+         // virtual thread waiting
+         boolean attempted = Blocker.begin();
          try {
              wait0(timeoutMillis);
          } catch (InterruptedException e) {
!             // virtual thread's interrupt status needs to be cleared
!             Thread.currentThread().getAndClearInterrupt();
              throw e;
          } finally {
!             Blocker.end(attempted);
          }
      }
  
      /**
       * Causes current thread to wait until another thread invokes the
< prev index next >