< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -1349,22 +1349,18 @@
             while (thread == curThread) {
                 // doIO is volatile, but we could check it, then get
                 // pre-empted while another thread changes doIO and notifies,
                 // before we wait (so we sleep in wait forever).
                 synchronized(lock) {
-                    if (!doIO) {
+                    while (!doIO && thread == curThread) {
                         try {
                             lock.wait();
-                        } catch(InterruptedException ie) {
-                        } finally {
-                            if (thread != curThread) {
-                                break;
-                            }
+                        } catch (InterruptedException ignored) {
                         }
                     }
                 }
-                while (doIO) {
+                while (doIO && thread == curThread) {
                     if (newFramePosition >= 0) {
                         clipBytePosition = newFramePosition * frameSize;
                         newFramePosition = -1;
                     }
                     int endFrame = getFrameLength() - 1;
< prev index next >