Class RefCountedEvent
A wrapper for the ManualResetEvent that enables reference counting. Used to keep track of multiple threads waiting for a single pending action.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public sealed class RefCountedEvent : IDisposable
Constructors
RefCountedEvent(Int32, Object)
Initializes a new instance of the RefCountedEvent class.
Declaration
public RefCountedEvent(int millisecondsTimeout, object context)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | millisecondsTimeout | The timeout in milliseconds. |
System.Object | context | The context for the instance. |
RefCountedEvent(Object)
Initializes a new instance of the RefCountedEvent class.
Declaration
public RefCountedEvent(object context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | context | The context for the instance. |
Properties
Context
Gets the context for which the instance was created with.
Declaration
public object Context { get; }
Property Value
Type | Description |
---|---|
System.Object | The context. |
Methods
CacheRemovalCallback(String, Object, CacheItemRemovedReason)
If passed in value is an RefCountedEvent instance, that instace is signalled with Failure reason indicating that the value was evicted from cache so waiting threads are released.
Declaration
public static void CacheRemovalCallback(string key, object value, CacheItemRemovedReason reason)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The cache key for the object that was evicted. |
System.Object | value | The cached object that was evicted. |
System.Web.Caching.CacheItemRemovedReason | reason | The reason for the cache removal. |
Dispose()
Declaration
public void Dispose()
Signal()
Signals the event with Success reason.
Declaration
public void Signal()
Signal(SignalReason)
Signals the event with specified reason.
Declaration
public void Signal(SignalReason reason)
Parameters
Type | Name | Description |
---|---|---|
SignalReason | reason | The reason. |
Wait()
Enter wait state for calling thread.
Declaration
public SignalReason Wait()
Returns
Type | Description |
---|---|
SignalReason | Reason for the outcome of the wait operation. |