<Sound Dev> [10] Review Request: 8178403 DirectAudio in JavaSound may hang and leak
Sergey Bylokhov
sergey.bylokhov at oracle.com
Wed Jul 5 18:06:39 UTC 2017
> thread is assigned on creation and we are checking it in run() so
> (thread == curThread) seems like it must be true until somehow
> implClose() is called :
> So why not just check if (thread == null) instead ?
This is because we assign the "thread" in the open() method, not in the constructor. If the user will call open->close->open, then two threads will be created (the first thread should be stopped after the close() was called).
>
> And when can oldThread will be null ? If someone called stop twice ?
If open() was not called.
>
> And why is there no thread = null assignment in implClose() ?
It is there:
1300 Thread oldThread = thread;
1301 thread = null;
> Shouldn't you update the test to add this new bug id ?
Yes, it should:
http://cr.openjdk.java.net/~serb/8178403/webrev.01
More information about the sound-dev
mailing list