final class · System.Reflection
Reentrant
final class Reentrant
A lock that the thread holding it may take again (the slow path of typeof may describe other types meanwhile).
- Tipo
- final class
- Espacio de nombres
- System.Reflection
- Ensamblado
- System.Core
- Acceso
- internal, final
- Archivo fuente
Reflection.ant
Herencia
- Clases base
-
AnyReentrant
Constructores
new()
#
Métodos
Miembros heredados (5)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
Reentrant en Antril, descompilado a partir de su Larva HIR.
// System.Reflection.Reentrant — System.Core (decompiled from Larva HIR)
import System.Threading;
into namespace System.Reflection
{
/// A lock that the thread holding it may take again (the slow path of `typeof` may describe other types meanwhile).
final class Reentrant
{
readonly Mutex mutex;
i32 owner;
i32 depth;
public:
new()
{
mutex = new Mutex();
}
Enter()
{
i32 me = Thread.CurrentId;
if (owner == me && depth > 0)
{
depth++;
return;
}
mutex.Lock();
owner = me;
depth = 1;
}
Exit()
{
depth--;
if (depth == 0)
{
owner = 0;
mutex.Unlock();
}
}
}
}