public static final boolean isLockedByOtherThread(final GLAutoDrawable d) { final Thread currentThread = Thread.currentThread(); final Thread upstreamLockOwner = d.getUpstreamLock().getOwner(); if( null != upstreamLockOwner && currentThread != upstreamLockOwner ) { return true; } else { final NativeSurface s = d.getNativeSurface(); final Thread surfaceLockOwner = null != s ? s.getSurfaceLockOwner() : null; return null != surfaceLockOwner && currentThread != surfaceLockOwner; } }
public static final boolean isLockedByThisThread(final GLAutoDrawable d) { final Thread currentThread = Thread.currentThread(); final Thread upstreamLockOwner = d.getUpstreamLock().getOwner(); if( currentThread == upstreamLockOwner ) { return true; } else { final NativeSurface s = d.getNativeSurface(); final Thread surfaceLockOwner = null != s ? s.getSurfaceLockOwner() : null; return currentThread == surfaceLockOwner; } }
/** * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(javax.media.nativewindow.NativeSurface)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static void resetDisplayGamma(final GLAutoDrawable drawable) { final RecursiveLock lock = drawable.getUpstreamLock(); lock.lock(); try { GLDrawableFactory.getFactory(drawable.getGLProfile()).resetDisplayGamma(drawable.getNativeSurface()); } finally { lock.unlock(); } }
/** * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(javax.media.nativewindow.NativeSurface, float, float, float)} * locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation. */ public static boolean setDisplayGamma(final GLAutoDrawable drawable, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { final RecursiveLock lock = drawable.getUpstreamLock(); lock.lock(); try { return GLDrawableFactory.getFactory(drawable.getGLProfile()).setDisplayGamma(drawable.getNativeSurface(), gamma, brightness, contrast); } finally { lock.unlock(); } }
final RecursiveLock srcUpstreamLock = src.getUpstreamLock(); srcUpstreamLock.lock(); try {
final int aSz = listenerCount(); final RecursiveLock destUpstreamLock = dest.getUpstreamLock(); destUpstreamLock.lock(); final boolean destIsRealized;
final boolean bIsPaused = isAnimatorAnimatingOnOtherThread(bAnim) && bAnim.pause(); final RecursiveLock aUpstreamLock = a.getUpstreamLock(); final RecursiveLock bUpstreamLock = b.getUpstreamLock(); aUpstreamLock.lock(); bUpstreamLock.lock();