|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.sys.Lock
This allows only a single mThread/Coroutine to hold a Lock at a time.
| Field Summary | |
boolean |
multipleEntry
If this is true then a thread can call hold()/grab() on a lock multiple times - defaults to true. |
| Constructor Summary | |
Lock()
|
|
| Method Summary | |
boolean |
grab()
This tries to get ownership of the lock, but will not wait if it cannot get ownership immediately. |
boolean |
grabAndNotify(boolean doNotifyAll)
This grabs the lock, notifies waiting threads and then releases the lock. |
boolean |
hold()
Deprecated. use lock() instead. |
boolean |
hold(TimeOut t)
Deprecated. use lock(TimeOut t) instead. |
boolean |
holdAndNotify(TimeOut howLong,
boolean doNotifyAll)
This grabs the lock, notifies waiting threads and then releases the lock. |
void |
lock()
Attempt to acquire ownership of the Lock, waiting indefinitely. |
boolean |
lock(TimeOut t)
Attempt to acquire ownership of the Lock, waiting for a specific length of time. |
void |
notifyAllWaiting()
This causes all Coroutines which are waiting on the lock to wakeup and attempt to reacquire ownership of the lock. |
void |
notifyWaiting()
This causes one Coroutine which is waiting on the lock to wakeup and reacquire ownership of the lock. |
boolean |
release()
Release the lock. |
void |
synchronize()
This attempts to hold the lock, waiting an indefinite time to do so. |
void |
unlock()
Release the lock. |
boolean |
wait(TimeOut howLong)
Deprecated. - use waitOn(TimeOut howLong) instead. |
void |
waitOn()
This causes the current mThread, which must own the lock, to release it and wait indefinitely until notifyWaiting() is called on the lock. |
boolean |
waitOn(int milliSeconds)
This causes the current mThread, which must own the lock, to release it and wait until notifyWaiting() is called on the lock. |
boolean |
waitOn(TimeOut howLong)
This causes the current mThread, which must own the lock, to release it and wait until notifyWaiting() is called on the lock. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public boolean multipleEntry
| Constructor Detail |
public Lock()
| Method Detail |
public void synchronize()
public boolean grab()
public boolean hold(TimeOut t)
t - A Timeout specifying how long to wait to acquire the lock. Set to TimeOut.Forever to wait
indefinitely.
public boolean hold()
public boolean lock(TimeOut t)
throws InterruptedException
t - The length of time to wait for.
InterruptedException - If the Thread was interrupted.
public void lock()
throws InterruptedException
InterruptedException - If the Thread was interrupted while waiting for the lock.public boolean release()
public void unlock()
throws IllegalThreadStateException
IllegalThreadStateExceptionpublic boolean wait(TimeOut howLong)
This can ONLY be called by a Coroutine/mThread.
howLong - The length of time to wait. You can use TimeOut.Forever to wait indefinitely.
public boolean waitOn(int milliSeconds)
throws InterruptedException
milliSeconds - The length of time to wait in milliseconds.
InterruptedException - If the Thread was interrupted while waiting.
public void waitOn()
throws InterruptedException
InterruptedException - If the Thread was interrupted while waiting.
public boolean waitOn(TimeOut howLong)
throws InterruptedException
howLong - The length of time to wait. You can use TimeOut.Forever to wait indefinitely.
InterruptedException - If the Thread was interrupted while waiting.public void notifyWaiting()
public void notifyAllWaiting()
public boolean grabAndNotify(boolean doNotifyAll)
doNotifyAll - if this is true then a notifyAllWaiting() will be done, otherwise a notifyWaiting() will be done.
public boolean holdAndNotify(TimeOut howLong,
boolean doNotifyAll)
doNotifyAll - if this is true then a notifyAllWaiting() will be done, otherwise a notifyWaiting() will be done.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||