summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-02-22 14:21:29 +0100
committerSven Gothel <[email protected]>2011-02-22 14:21:29 +0100
commite587f2a724c79d50118f717cc29fba78cad0feeb (patch)
tree06e2a661139f477a387c4d2835d9359fa7f0399f /src/nativewindow/classes/javax
parent1411387d54bc5d946bd3528f97c9a2a15dd2f9de (diff)
NativeWindow NativeSurface lock/unlock Surface cleanup ; NEWT WindowImpl lock/unlock Surface fix
- Rename lock to surfaceLock to determine it's use - NEWT's WindowImpl windowLock usage is not sufficient for lock/unlock surface. Using distinguished surfaceLock for proper recursion count on lock/unlock surface.
Diffstat (limited to 'src/nativewindow/classes/javax')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index 386ba32f4..038580ce0 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -31,7 +31,7 @@ package javax.media.nativewindow;
import com.jogamp.common.util.locks.RecursiveLock;
public abstract class ProxySurface implements NativeSurface {
- protected RecursiveLock recurLock = new RecursiveLock();
+ protected RecursiveLock surfaceLock = new RecursiveLock();
protected AbstractGraphicsConfiguration config;
protected long displayHandle;
protected int height;
@@ -44,14 +44,9 @@ public abstract class ProxySurface implements NativeSurface {
displayHandle=cfg.getScreen().getDevice().getHandle();
}
- public final void invalidate() {
- recurLock.lock();
- try {
- displayHandle = 0;
- invalidateImpl();
- } finally {
- recurLock.unlock();
- }
+ void invalidate() {
+ displayHandle = 0;
+ invalidateImpl();
}
protected abstract void invalidateImpl();
@@ -90,8 +85,8 @@ public abstract class ProxySurface implements NativeSurface {
}
public int lockSurface() throws NativeWindowException {
- recurLock.lock();
- int res = recurLock.getRecursionCount() == 0 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS;
+ surfaceLock.lock();
+ int res = surfaceLock.getRecursionCount() == 0 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS;
if ( LOCK_SURFACE_NOT_READY == res ) {
try {
@@ -106,7 +101,7 @@ public abstract class ProxySurface implements NativeSurface {
}
} finally {
if (LOCK_SURFACE_NOT_READY >= res) {
- recurLock.unlock();
+ surfaceLock.unlock();
}
}
}
@@ -114,9 +109,9 @@ public abstract class ProxySurface implements NativeSurface {
}
public final void unlockSurface() {
- recurLock.validateLocked();
+ surfaceLock.validateLocked();
- if (recurLock.getRecursionCount() == 0) {
+ if (surfaceLock.getRecursionCount() == 0) {
final AbstractGraphicsDevice adevice = config.getScreen().getDevice();
try {
unlockSurfaceImpl();
@@ -124,7 +119,7 @@ public abstract class ProxySurface implements NativeSurface {
adevice.unlock();
}
}
- recurLock.unlock();
+ surfaceLock.unlock();
}
protected abstract int lockSurfaceImpl();
@@ -132,23 +127,23 @@ public abstract class ProxySurface implements NativeSurface {
protected abstract void unlockSurfaceImpl() ;
public final void validateSurfaceLocked() {
- recurLock.validateLocked();
+ surfaceLock.validateLocked();
}
public final boolean isSurfaceLocked() {
- return recurLock.isLocked();
+ return surfaceLock.isLocked();
}
public final boolean isSurfaceLockedByOtherThread() {
- return recurLock.isLockedByOtherThread();
+ return surfaceLock.isLockedByOtherThread();
}
public final Thread getSurfaceLockOwner() {
- return recurLock.getOwner();
+ return surfaceLock.getOwner();
}
public final int getSurfaceRecursionCount() {
- return recurLock.getRecursionCount();
+ return surfaceLock.getRecursionCount();
}
public abstract String toString();