Semaphore.AcquireUninterruptibly Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AcquireUninterruptibly() |
Acquires a permit from this semaphore, blocking until one is available. |
AcquireUninterruptibly(Int32) |
Acquires the given number of permits from this semaphore, blocking until all are available. |
AcquireUninterruptibly()
Acquires a permit from this semaphore, blocking until one is available.
[Android.Runtime.Register("acquireUninterruptibly", "()V", "GetAcquireUninterruptiblyHandler")]
public virtual void AcquireUninterruptibly ();
[<Android.Runtime.Register("acquireUninterruptibly", "()V", "GetAcquireUninterruptiblyHandler")>]
abstract member AcquireUninterruptibly : unit -> unit
override this.AcquireUninterruptibly : unit -> unit
- Attributes
Remarks
Acquires a permit from this semaphore, blocking until one is available.
Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
If no permit is available then the current thread becomes disabled for thread scheduling purposes and lies dormant until some other thread invokes the #release
method for this semaphore and the current thread is next to be assigned a permit.
If the current thread is Thread#interrupt interrupted while waiting for a permit then it will continue to wait, but the time at which the thread is assigned a permit may change compared to the time it would have received the permit had no interruption occurred. When the thread does return from this method its interrupt status will be set.
Java documentation for java.util.concurrent.Semaphore.acquireUninterruptibly()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
AcquireUninterruptibly(Int32)
Acquires the given number of permits from this semaphore, blocking until all are available.
[Android.Runtime.Register("acquireUninterruptibly", "(I)V", "GetAcquireUninterruptibly_IHandler")]
public virtual void AcquireUninterruptibly (int permits);
[<Android.Runtime.Register("acquireUninterruptibly", "(I)V", "GetAcquireUninterruptibly_IHandler")>]
abstract member AcquireUninterruptibly : int -> unit
override this.AcquireUninterruptibly : int -> unit
Parameters
- permits
- Int32
the number of permits to acquire
- Attributes
Exceptions
if permits
is negative
Remarks
Acquires the given number of permits from this semaphore, blocking until all are available.
Acquires the given number of permits, if they are available, and returns immediately, reducing the number of available permits by the given amount. This method has the same effect as the loop for (int i = 0; i < permits; ++i) acquireUninterruptibly();
except that it atomically acquires the permits all at once:
If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes and lies dormant until some other thread invokes one of the #release() release
methods for this semaphore and the current thread is next to be assigned permits and the number of available permits satisfies this request.
If the current thread is Thread#interrupt interrupted while waiting for permits then it will continue to wait and its position in the queue is not affected. When the thread does return from this method its interrupt status will be set.
Java documentation for java.util.concurrent.Semaphore.acquireUninterruptibly(int)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.