diff options
Diffstat (limited to 'src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java')
-rw-r--r-- | src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java b/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java index 626199f..a23c320 100644 --- a/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java +++ b/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java @@ -34,67 +34,67 @@ package com.jogamp.common.util.locks; * </p> */ public interface RecursiveThreadGroupLock extends RecursiveLock { - /** - * Returns true if the current thread is the original lock owner, ie. + /** + * Returns true if the current thread is the original lock owner, ie. * successfully claimed this lock the first time, ie. {@link #getHoldCount()} == 1. */ boolean isOriginalOwner(); - - /** - * Returns true if the passed thread is the original lock owner, ie. + + /** + * Returns true if the passed thread is the original lock owner, ie. * successfully claimed this lock the first time, ie. {@link #getHoldCount()} == 1. */ boolean isOriginalOwner(Thread thread); - - /** + + /** * Add a thread to the list of additional lock owners, which enables them to recursively claim this lock. * <p> * The caller must hold this lock and be the original lock owner, see {@link #isOriginalOwner()}. * </p> * <p> - * If the original owner releases this lock via {@link #unlock()} + * If the original owner releases this lock via {@link #unlock()} * all additional lock owners are released as well. * This ensures consistency of spawn off additional lock owner threads and it's release. - * </p> + * </p> * Use case: * <pre> * Thread2 thread2 = new Thread2(); - * + * * Thread1 { - * + * * // Claim this lock and become the original lock owner. * lock.lock(); - * + * * try { - * + * * // Allow Thread2 to claim the lock, ie. make thread2 an additional lock owner * addOwner(thread2); - * + * * // Start thread2 * thread2.start(); - * + * * // Wait until thread2 has finished requiring this lock, but keep thread2 running - * while(!thread2.waitForResult()) sleep(); - * + * while(!thread2.waitForResult()) sleep(); + * * // Optional: Only if sure that this thread doesn't hold the lock anymore, - * // otherwise just release the lock via unlock(). + * // otherwise just release the lock via unlock(). * removeOwner(thread2); - * + * * } finally { - * + * * // Release this lock and remove all additional lock owners. * // Implicit wait until thread2 gets off the lock. * lock.unlock(); - * + * * } - * + * * }.start(); * </pre> - * - * @param t the thread to be added to the list of additional owning threads + * + * @param t the thread to be added to the list of additional owning threads * @throws RuntimeException if the current thread does not hold the lock. * @throws IllegalArgumentException if the passed thread is the lock owner or already added. - * + * * @see #removeOwner(Thread) * @see #unlock() * @see #lock() @@ -109,31 +109,31 @@ public interface RecursiveThreadGroupLock extends RecursiveLock { * <p> * Only use this method if sure that the thread doesn't hold the lock anymore. * </p> - * - * @param t the thread to be removed from the list of additional owning threads + * + * @param t the thread to be removed from the list of additional owning threads * @throws RuntimeException if the current thread does not hold the lock. * @throws IllegalArgumentException if the passed thread is not added by {@link #addOwner(Thread)} */ void removeOwner(Thread t) throws RuntimeException, IllegalArgumentException; - + /** * <p> * Wait's until all additional owners released this lock before releasing it. * </p> - * + * * {@inheritDoc} */ @Override void unlock() throws RuntimeException; - + /** * <p> * Wait's until all additional owners released this lock before releasing it. * </p> - * + * * {@inheritDoc} */ @Override - void unlock(Runnable taskAfterUnlockBeforeNotify); - + void unlock(Runnable taskAfterUnlockBeforeNotify); + } |