|
Préférences
Moteurs de recherche
|
||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
java.util.concurrent.locks
|
Method Summary | |
---|---|
static Object |
getBlocker(Thread t)
Returns the blocker object supplied to the most recent invocation of a park method that has not yet unblocked, or null if not blocked. |
static void |
park()
Disables the current thread for thread scheduling purposes unless the permit is available. |
static void |
park(Object blocker)
Disables the current thread for thread scheduling purposes unless the permit is available. |
static void |
parkNanos(long nanos)
Disables the current thread for thread scheduling purposes, for up to the specified waiting time, unless the permit is available. |
static void |
parkNanos(Object blocker,
long nanos)
Disables the current thread for thread scheduling purposes, for up to the specified waiting time, unless the permit is available. |
static void |
parkUntil(long deadline)
Disables the current thread for thread scheduling purposes, until the specified deadline, unless the permit is available. |
static void |
parkUntil(Object blocker,
long deadline)
Disables the current thread for thread scheduling purposes, until the specified deadline, unless the permit is available. |
static void |
unpark(Thread thread)
Makes available the permit for the given thread, if it was not already available. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void unpark(Thread thread)
park
then it will unblock. Otherwise, its next call
to park
is guaranteed not to block. This operation
is not guaranteed to have any effect at all if the given
thread has not been started.
thread
- the thread to unpark, or null
, in which case
this operation has no effectpublic static void park(Object blocker)
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
unpark
with the
current thread as the target; or
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread upon return.
blocker
- the synchronization object responsible for this
thread parkingpublic static void parkNanos(Object blocker, long nanos)
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
unpark
with the
current thread as the target; or
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the elapsed time upon return.
blocker
- the synchronization object responsible for this
thread parkingnanos
- the maximum number of nanoseconds to waitpublic static void parkUntil(Object blocker, long deadline)
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
unpark
with the
current thread as the target; or
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the current time upon return.
blocker
- the synchronization object responsible for this
thread parkingdeadline
- the absolute time, in milliseconds from the Epoch,
to wait untilpublic static Object getBlocker(Thread t)
public static void park()
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
unpark
with the
current thread as the target; or
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread upon return.
public static void parkNanos(long nanos)
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
unpark
with the
current thread as the target; or
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the elapsed time upon return.
nanos
- the maximum number of nanoseconds to waitpublic static void parkUntil(long deadline)
If the permit is available then it is consumed and the call returns immediately; otherwise the current thread becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
unpark
with the
current thread as the target; or
This method does not report which of these caused the method to return. Callers should re-check the conditions which caused the thread to park in the first place. Callers may also determine, for example, the interrupt status of the thread, or the current time upon return.
deadline
- the absolute time, in milliseconds from the Epoch,
to wait until