class · System.Threading

SemaphoreSlim

public class System.Threading.SemaphoreSlim : System.Any

Counts permits: Wait takes one (waiting while there are none), Release gives them back.

Kind
class
Namespace
System.Threading
Assembly
System.Core
Access
public, final
Source file
Threading.ant

Inheritance

Base classes
Any SemaphoreSlim

Constructors

constructor SemaphoreSlim(initialCount: i32)
#
constructor SemaphoreSlim(initialCount: i32, maxCount: i32)
#

Properties

property CurrentCount: i32
#

read-only

Methods

method Wait() -> void
#
method Wait(milliseconds: i32) -> bool
#

Waits at most milliseconds: whether it took a permit.

method Release(releaseCount: i32) -> i32
#

Gives releaseCount permits back: the count before.

method Release() -> i32
#
method Dispose() -> void
#

Frees what it holds (it must not be used after).

Private and internal members (4)

field mutex: System.Threading.Mutex
#

private

field changed: System.Threading.Condition
#

private

field count: i32
#

private

field most: i32
#

private

Inherited members (5)

Source

SemaphoreSlim as Larva HIR, decompiled from its Larva HIR.

System.Threading.SemaphoreSlim.hir
// Counts permits: Wait takes one (waiting while there are none), Release gives them back.
public class System.Threading.SemaphoreSlim : System.Any
{
    field mutex: System.Threading.Mutex
    field changed: System.Threading.Condition
    field count: i32
    field most: i32
    constructor SemaphoreSlim(initialCount: i32)
    constructor SemaphoreSlim(initialCount: i32, maxCount: i32)
    method Wait() -> void
    // Waits at most `milliseconds`: whether it took a permit.
    method Wait(milliseconds: i32) -> bool
    // Gives `releaseCount` permits back: the count before.
    method Release(releaseCount: i32) -> i32
    method Release() -> i32
    // Frees what it holds (it must not be used after).
    method Dispose() -> void
    property CurrentCount: i32
}
Esc