final class · System.Threading
Condition
public final class Condition
Waiting until another thread says something changed: Wait releases the mutex (which the caller holds) while it waits and takes it back before it returns. Signal wakes one waiter, Broadcast all. Wake-ups can be spurious: wait in a loop that checks what is waited for.
- Tipo
- final class
- Espacio de nombres
- System.Threading
- Ensamblado
- System.Core
- Acceso
- public, final
- Archivo fuente
Threading.ant
Herencia
- Clases base
-
AnyCondition
Constructores
new()
#
Métodos
Waits at most milliseconds: false when the time ran out.
Signal()
#
Broadcast()
#
Dispose()
#
Frees it (it must not be used after; an undisposed one is freed when the object dies).
override destroy()
#
Miembros privados e internos (6)
Miembros heredados (4)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Any
Código fuente
Condition en Antril, descompilado a partir de su Larva HIR.
// System.Threading.Condition — System.Core (decompiled from Larva HIR)
into namespace System.Threading
{
/// Waiting until another thread says something changed: Wait releases the mutex (which the caller holds) while it
/// waits and takes it back before it returns. Signal wakes one waiter, Broadcast all. Wake-ups can be spurious: wait in
/// a loop that checks what is waited for.
public final class Condition
{
i64 handle;
static extern("cond.new") New() : i64;
static extern("cond.wait") WaitNative(i64 condition, i64 mutex, i64 milliseconds) : i64;
static extern("cond.signal") SignalNative(i64 condition);
static extern("cond.broadcast") BroadcastNative(i64 condition);
static extern("cond.free") Free(i64 condition);
public:
new()
{
handle = New();
}
Wait(Mutex mutex)
{
WaitNative(handle, mutex.Handle, -1);
}
/// Waits at most `milliseconds`: false when the time ran out.
Wait(Mutex mutex, i32 milliseconds) : bool => WaitNative(handle, mutex.Handle, milliseconds) != 0;
Signal()
{
SignalNative(handle);
}
Broadcast()
{
BroadcastNative(handle);
}
/// Frees it (it must not be used after; an undisposed one is freed when the object dies).
Dispose()
{
if (handle != 0)
Free(handle);
handle = 0;
}
override destroy()
{
try
{
Dispose();
}
finally
{
base.destroy();
}
}
}
}