Show / Hide Table of Contents

Struct Epoch.Scope

Represents a scope of the region of code protected by the epoch.

Implements
IDisposable
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public readonly struct Epoch.Scope : IDisposable

Methods

View Source

Defer(Action)

Registers user action to be called at some point in future when the resource protected by the epoch is no longer available to any consumer.

Declaration
public void Defer(Action callback)
Parameters
Type Name Description
Action callback

The callback to enqueue.

Remarks

Invocation order of callbacks is not guaranteed.

Exceptions
Type Condition
ArgumentNullException

callback is null.

View Source

Defer<TWorkItem>(TWorkItem)

Registers user action to be called at some point in future when the resource protected by the epoch is no longer available to any consumer.

Declaration
public void Defer<TWorkItem>(TWorkItem workItem) where TWorkItem : struct, IThreadPoolWorkItem
Parameters
Type Name Description
TWorkItem workItem

The callback to enqueue.

Type Parameters
Name Description
TWorkItem

The type of the callback.

View Source

Defer<T>(T, Action<T>)

Registers user action to be called at some point in future when the resource protected by the epoch is no longer available to any consumer.

Declaration
public void Defer<T>(T arg, Action<T> callback)
Parameters
Type Name Description
T arg

The argument to be passed to the callback.

Action<T> callback

The callback to enqueue.

Type Parameters
Name Description
T
Remarks

Invocation order of callbacks is not guaranteed.

Exceptions
Type Condition
ArgumentNullException

callback is null.

View Source

Dispose()

Releases epoch scope.

Declaration
public void Dispose()
Remarks

This method is not idempotent and should not be called twice.

View Source

Reclaim(bool)

Reclaims the deferred actions.

Declaration
public Epoch.RecycleBin Reclaim(bool drainGlobalCache = false)
Parameters
Type Name Description
bool drainGlobalCache

true to capture all deferred actions across all threads; false to capture actions that were deferred by the current thread at some point in the past.

Returns
Type Description
Epoch.RecycleBin

A collection of reclaimed actions that can be executed at any point in time.

View Source

RegisterForDiscard(Discardable)

Registers an object to be disposed at some point in future when the resource protected by the epoch is no longer available to any consumer.

Declaration
public void RegisterForDiscard(Epoch.Discardable discardable)
Parameters
Type Name Description
Epoch.Discardable discardable

An object to be disposed.

Exceptions
Type Condition
ArgumentNullException

discardable is null.

View Source

RegisterForDispose(IDisposable)

Registers an object to be disposed at some point in future when the resource protected by the epoch is no longer available to any consumer.

Declaration
public void RegisterForDispose(IDisposable disposable)
Parameters
Type Name Description
IDisposable disposable

An object to be disposed.

Exceptions
Type Condition
ArgumentNullException

disposable is null.

Implements

IDisposable

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾