In Mustang-b27 we integrated the single-threaded rendering project for the OGL-based
Java 2D pipeline. Unfortunately this architecture has the potential for deadlock
with the AWT Toolkit thread. See 6253009, 6280286, and 6249101 for more information
on three related, but separate deadlock issues.
There are a number of ways to solve the problem, most of which are complicated and
require lots of changes. There is one simple solution, however, that avoids the
deadlock by only entering the AWT lock if it is not already held. This solution
requires functionality similar to ReentrantLock.tryLock(), but currently there is
no tryLock() functionality for simple Java monitors (via the synchronized keyword
or Unsafe.monitorEnter/Exit(), both of which are used to manage the AWT lock).
This RFE is requesting a new Unsafe.tryMonitorEnter() method, with functionality
similar to ReentrantLock.tryLock(). In sun.misc.Unsafe:
public boolean tryMonitorEnter(Object o);
This method would enter the monitor and return true if it is not currently locked;
false otherwise. Note that we only need to call this method from Java code, so there
is no need for a new JNI entrypoint offering this functionality.
Java 2D pipeline. Unfortunately this architecture has the potential for deadlock
with the AWT Toolkit thread. See 6253009, 6280286, and 6249101 for more information
on three related, but separate deadlock issues.
There are a number of ways to solve the problem, most of which are complicated and
require lots of changes. There is one simple solution, however, that avoids the
deadlock by only entering the AWT lock if it is not already held. This solution
requires functionality similar to ReentrantLock.tryLock(), but currently there is
no tryLock() functionality for simple Java monitors (via the synchronized keyword
or Unsafe.monitorEnter/Exit(), both of which are used to manage the AWT lock).
This RFE is requesting a new Unsafe.tryMonitorEnter() method, with functionality
similar to ReentrantLock.tryLock(). In sun.misc.Unsafe:
public boolean tryMonitorEnter(Object o);
This method would enter the monitor and return true if it is not currently locked;
false otherwise. Note that we only need to call this method from Java code, so there
is no need for a new JNI entrypoint offering this functionality.
- relates to
-
JDK-6253009 OGL+XAWT: deadlock occurs when Swing calls BufferStrategy.show() on XToolkit thread
-
- Resolved
-
-
JDK-6307934 RFE: Unsafe.tryMonitorEnter() support in JDK
-
- Resolved
-