summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java11
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java7
2 files changed, 8 insertions, 10 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index 038580ce0..e34476228 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -28,10 +28,11 @@
package javax.media.nativewindow;
+import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
public abstract class ProxySurface implements NativeSurface {
- protected RecursiveLock surfaceLock = new RecursiveLock();
+ protected RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
protected AbstractGraphicsConfiguration config;
protected long displayHandle;
protected int height;
@@ -86,7 +87,7 @@ public abstract class ProxySurface implements NativeSurface {
public int lockSurface() throws NativeWindowException {
surfaceLock.lock();
- int res = surfaceLock.getRecursionCount() == 0 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS;
+ int res = surfaceLock.getHoldCount() == 1 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS; // new lock ?
if ( LOCK_SURFACE_NOT_READY == res ) {
try {
@@ -111,7 +112,7 @@ public abstract class ProxySurface implements NativeSurface {
public final void unlockSurface() {
surfaceLock.validateLocked();
- if (surfaceLock.getRecursionCount() == 0) {
+ if (surfaceLock.getHoldCount() == 1) {
final AbstractGraphicsDevice adevice = config.getScreen().getDevice();
try {
unlockSurfaceImpl();
@@ -142,9 +143,5 @@ public abstract class ProxySurface implements NativeSurface {
return surfaceLock.getOwner();
}
- public final int getSurfaceRecursionCount() {
- return surfaceLock.getRecursionCount();
- }
-
public abstract String toString();
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
index 65fb31d72..2c80392ad 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
@@ -37,6 +37,7 @@
package jogamp.nativewindow.jawt;
+import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
import java.awt.Component;
@@ -112,13 +113,13 @@ public abstract class JAWTWindow implements NativeWindow {
// NativeSurface
//
- private RecursiveLock surfaceLock = new RecursiveLock();
+ private RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
protected abstract int lockSurfaceImpl() throws NativeWindowException;
public final int lockSurface() throws NativeWindowException {
surfaceLock.lock();
- int res = surfaceLock.getRecursionCount() == 0 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS;
+ int res = surfaceLock.getHoldCount() == 1 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS; // new lock ?
if ( LOCK_SURFACE_NOT_READY == res ) {
try {
@@ -145,7 +146,7 @@ public abstract class JAWTWindow implements NativeWindow {
public final void unlockSurface() {
surfaceLock.validateLocked();
- if (surfaceLock.getRecursionCount() == 0) {
+ if (surfaceLock.getHoldCount() == 1) {
final AbstractGraphicsDevice adevice = config.getScreen().getDevice();
try {
unlockSurfaceImpl();