From f62d05209174a8e54f94d40209e441c2de2a1003 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Fri, 9 Feb 2007 09:59:28 +0000 Subject: [PATCH] Improve Javadoc --- .../src/org/eclipse/rse/services/Mutex.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java index 60816c069db..8c45ee3549f 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java @@ -19,11 +19,12 @@ import org.eclipse.core.runtime.IProgressMonitor; /** * A Mutual Exclusion Lock for Threads that need to access a resource - * in a serialized manner. + * in a serialized manner. An Eclipse ProgressMonitor is accepted + * in order to support cancellation when waiting for the Mutex. * * Usage Example: * - * private Mutex fooMutex; + * private Mutex fooMutex = new Mutex(); * boolean doFooSerialized()(IProgressMonitor monitor) { * if (fooMutex.waitForLock(monitor, 1000)) { * try { @@ -35,11 +36,20 @@ import org.eclipse.core.runtime.IProgressMonitor; * return false; * } * + * + * The Mutex is not reentrant, so when a Thread has locked the + * Mutex it must not try locking it again. */ public class Mutex { private boolean fLocked = false; private List fWaitQueue = new LinkedList(); + + /** + * Creates an instance of Mutex. + */ + public Mutex() { + } /** * Try to acquire the lock maintained by this mutex.