mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +02:00
Improve Javadoc
This commit is contained in:
parent
df030c023f
commit
f62d052091
1 changed files with 12 additions and 2 deletions
|
@ -19,11 +19,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Mutual Exclusion Lock for Threads that need to access a resource
|
* 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:
|
* Usage Example:
|
||||||
* <code>
|
* <code>
|
||||||
* private Mutex fooMutex;
|
* private Mutex fooMutex = new Mutex();
|
||||||
* boolean doFooSerialized()(IProgressMonitor monitor) {
|
* boolean doFooSerialized()(IProgressMonitor monitor) {
|
||||||
* if (fooMutex.waitForLock(monitor, 1000)) {
|
* if (fooMutex.waitForLock(monitor, 1000)) {
|
||||||
* try {
|
* try {
|
||||||
|
@ -35,11 +36,20 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
* return false;
|
* return false;
|
||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
|
*
|
||||||
|
* The Mutex is not reentrant, so when a Thread has locked the
|
||||||
|
* Mutex it must not try locking it again.
|
||||||
*/
|
*/
|
||||||
public class Mutex {
|
public class Mutex {
|
||||||
|
|
||||||
private boolean fLocked = false;
|
private boolean fLocked = false;
|
||||||
private List fWaitQueue = new LinkedList();
|
private List fWaitQueue = new LinkedList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an instance of <tt>Mutex</tt>.
|
||||||
|
*/
|
||||||
|
public Mutex() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to acquire the lock maintained by this mutex.
|
* Try to acquire the lock maintained by this mutex.
|
||||||
|
|
Loading…
Add table
Reference in a new issue