6968933: Clip loop() deadlock in DirectAudioDevice$DirectClip.run
Reviewed-by: amenkov
--- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Tue Dec 21 17:35:47 2010 +0800
+++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java Tue Dec 21 11:32:34 2010 +0000
@@ -1393,8 +1393,11 @@
public void run() {
if (Printer.trace) Printer.trace(">>> DirectClip: run() threadID="+Thread.currentThread().getId());
while (thread != null) {
- if (!doIO) {
- synchronized(lock) {
+ // 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) {
try {
lock.wait();
} catch(InterruptedException ie) {}