final class · System.Threading

AutoResetEvent

public final class AutoResetEvent : ManualResetEvent

An event that lets one waiter through each time it is set (and resets itself).

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

Herencia

Clases base
Any ManualResetEvent AutoResetEvent

Constructores

new(bool initialState)
#

Métodos

override WaitOne()
#

override

override WaitOne(i32 milliseconds) : bool
#

override

Miembros heredados (12)

Código fuente

AutoResetEvent en Antril, descompilado a partir de su Larva HIR.

System.Threading.AutoResetEvent.ant
// System.Threading.AutoResetEvent — System.Core (decompiled from Larva HIR)

import System;

into namespace System.Threading
{
	/// An event that lets one waiter through each time it is set (and resets itself).
	public final class AutoResetEvent : ManualResetEvent
	{
		public:
			new(bool initialState) : base(initialState)
			{
			}

			override WaitOne()
			{
				mutex.Lock();
				loop (!set)
					changed.Wait(mutex);
				set = false;
				mutex.Unlock();
			}

			override WaitOne(i32 milliseconds) : bool
			{
				i64 until = Environment.TickCount64 + (i64)milliseconds;
				mutex.Lock();
				loop (!set)
				{
					i64 left = until - Environment.TickCount64;
					if (left <= 0)
						break;
					changed.Wait(mutex, (i32)left);
				}
				bool result = set;
				set = false;
				mutex.Unlock();
				return result;
			}
	}
}
Esc