class · System.Threading

Mutex

public class System.Threading.Mutex : System.Any

A lock: one thread at a time between Lock and Unlock (not re-entrant: a thread that holds it must not lock it again). Run(() => …) holds it around a function. Dispose frees its handle (an undisposed one is freed when the object dies).

Tipo
class
Espacio de nombres
System.Threading
Ensamblado
System.Core
Acceso
public
Archivo fuente
Threading.ant

Herencia

Clases base
Any Mutex
Tipos derivados
Lock

Constructores

constructor Mutex()
#

Propiedades

property Handle: i64
#

read-only

The handle (for Condition).

Métodos

method Lock() -> void
#
method Unlock() -> void
#
method TryLock() -> bool
#

Takes it when no other thread holds it: whether it did.

method WaitOne() -> void
#

WaitOne and ReleaseMutex: the same as Lock and Unlock.

method ReleaseMutex() -> void
#
method Run(body: func<> : void) -> void
#

Runs body holding the lock.

method Dispose() -> void
#

Frees it (it must not be used after).

method destroy() -> void
#

override

Miembros privados e internos (6)

field handle: i64
#

private

static method New() -> i64
#

private static

static method LockNative(handle: i64) -> void
#

private static

static method TryNative(handle: i64) -> i64
#

private static

static method UnlockNative(handle: i64) -> void
#

private static

static method Free(handle: i64) -> void
#

private static

Miembros heredados (4)

Código fuente

Mutex en Larva HIR, descompilado a partir de su Larva HIR.

System.Threading.Mutex.hir
// A lock: one thread at a time between Lock and Unlock (not re-entrant: a thread that holds it must not lock it again).
// `Run(() => …)` holds it around a function. Dispose frees its handle (an undisposed one is freed when the object dies).
public class System.Threading.Mutex : System.Any
{
    field handle: i64
    static method New() -> i64
    static method LockNative(handle: i64) -> void
    static method TryNative(handle: i64) -> i64
    static method UnlockNative(handle: i64) -> void
    static method Free(handle: i64) -> void
    constructor Mutex()
    method Lock() -> void
    method Unlock() -> void
    // Takes it when no other thread holds it: whether it did.
    method TryLock() -> bool
    // WaitOne and ReleaseMutex: the same as Lock and Unlock.
    method WaitOne() -> void
    method ReleaseMutex() -> void
    // Runs `body` holding the lock.
    method Run(body: func<> : void) -> void
    // Frees it (it must not be used after).
    method Dispose() -> void
    method destroy() -> void
    // The handle (for Condition).
    property Handle: i64
}
Esc