You are right, it it undefined behavior.
On 10/6/16 10:02 AM, Semyon Sadetsky wrote:
Hi Alexander,
Is it safe to lock the mutex on one thread and unlock it on another?
--Semyon
On 06.10.2016 06:08, Alexander Zvegintsev wrote:
Hello,
please review the fix
http://cr.openjdk.java.net/~azvegint/jdk/9/8166942/00/
for the issue
https://bugs.openjdk.java.net/browse/JDK-8166942
SplashEventLoop() acquires the lock[0] and then trying to call
SplashRedrawWindow() which is trying execute some code on the main
thread[1]. Thus if we call SplashLock() from the main thread between
[0] and SplashRedrawWindow() calls then we are in deadlock. Main
thread is waiting for mutex release, other thread waiting for finish
of code execution on the main thread. It is our case [2].
The proposed solution is to acquire the lock on the main thread.
[0]
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/5518ac2f2ead/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m#l359
[1]
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/5518ac2f2ead/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m#l262
[2]
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/5518ac2f2ead/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c#l57
--
Thanks,
Alexander.