A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://dotnet.github.io/dotNext/api/DotNext.Threading.Atomic-1.html below:

Struct Atomic<T> | .NEXT

Struct Atomic<T>

Provides atomic access to non-primitive data type.

Namespace: DotNext.Threading Assembly: DotNext.dll Syntax
public struct Atomic<T> : IStrongBox, ICloneable where T : struct
Type Parameters Name Description T

The type of the value to be accessible in atomic manner.

Properties | Edit this page View Source Value

Gets or sets value atomically.

Declaration
public T Value { get; set; }
Property Value Methods | Edit this page View Source AccumulateAndGet(in T, Accumulator, out T)

Atomically updates the stored value with the results of applying the given function to the current and given values, returning the original value.

Declaration
public void AccumulateAndGet(in T x, Atomic<T>.Accumulator accumulator, out T result)
Parameters Type Name Description T x

Accumulator operand.

Atomic<T>.Accumulator accumulator

A side-effect-free function of two arguments.

T result

The updated value.

Remarks Exceptions | Edit this page View Source Clone()

Clones this container atomically.

Declaration Returns Type Description Atomic<T>

The cloned container.

| Edit this page View Source CompareAndSet(delegate*<in T, in T, bool>, in T, in T)

Atomically sets the stored value to the given updated value if the current value == the expected value.

Declaration
[CLSCompliant(false)]
public bool CompareAndSet(delegate*<in T, in T, bool> comparer, in T expected, in T update)
Parameters Type Name Description delegate*<in T, in T, bool> comparer

The function representing comparison logic.

T expected

The expected value.

T update

The new value.

Returns Type Description bool

true if successful. false return indicates that the actual value was not equal to the expected value.

| Edit this page View Source CompareAndSet(Func<T, T, bool>, in T, in T)

Atomically sets the stored value to the given updated value if the current value == the expected value.

Declaration
public bool CompareAndSet(Func<T, T, bool> comparer, in T expected, in T update)
Parameters Type Name Description Func<T, T, bool> comparer

The function representing comparison logic.

T expected

The expected value.

T update

The new value.

Returns Type Description bool

true if successful. false return indicates that the actual value was not equal to the expected value.

| Edit this page View Source CompareAndSet(in T, in T)

Atomically sets the stored value to the given updated value if the current value == the expected value.

Declaration
public bool CompareAndSet(in T expected, in T update)
Parameters Type Name Description T expected

The expected value.

T update

The new value.

Returns Type Description bool

true if successful. false return indicates that the actual value was not equal to the expected value.

| Edit this page View Source CompareExchange(delegate*<in T, in T, bool>, in T, in T, out T)

Compares two values of type T for equality and, if they are equal, replaces the stored value.

Declaration
[CLSCompliant(false)]
public bool CompareExchange(delegate*<in T, in T, bool> comparer, in T update, in T expected, out T result)
Parameters Type Name Description delegate*<in T, in T, bool> comparer

The function representing comparison logic.

T update

The value that replaces the stored value if the comparison results in equality.

T expected

The value that is compared to the stored value.

T result

The origin value stored in this container before modification.

Returns Type Description bool

true if the current value is replaced by update; otherwise, false.

| Edit this page View Source CompareExchange(Func<T, T, bool>, in T, in T, out T)

Compares two values of type T for equality and, if they are equal, replaces the stored value.

Declaration
public bool CompareExchange(Func<T, T, bool> comparer, in T update, in T expected, out T result)
Parameters Type Name Description Func<T, T, bool> comparer

The function representing comparison logic.

T update

The value that replaces the stored value if the comparison results in equality.

T expected

The value that is compared to the stored value.

T result

The origin value stored in this container before modification.

Returns Type Description bool

true if the current value is replaced by update; otherwise, false.

| Edit this page View Source CompareExchange(in T, in T, out T)

Compares two values of type T for bitwise equality and, if they are equal, replaces the stored value.

Declaration
public bool CompareExchange(in T update, in T expected, out T result)
Parameters Type Name Description T update

The value that replaces the stored value if the comparison results in equality.

T expected

The value that is compared to the stored value.

T result

The origin value stored in this container before modification.

Returns Type Description bool

true if the current value is replaced by update; otherwise, false.

| Edit this page View Source Exchange(in T, out T)

Sets a value stored in this container to a specified value and returns the original value, as an atomic operation.

Declaration
public void Exchange(in T update, out T previous)
Parameters Type Name Description T update

The value that replaces the stored value.

T previous

The original stored value before modification.

| Edit this page View Source GetAndAccumulate(in T, Accumulator, out T)

Atomically updates the stored value with the results of applying the given function to the current and given values, returning the updated value.

Declaration
public void GetAndAccumulate(in T x, Atomic<T>.Accumulator accumulator, out T result)
Parameters Type Name Description T x

Accumulator operand.

Atomic<T>.Accumulator accumulator

A side-effect-free function of two arguments.

T result

The original value.

Remarks Exceptions | Edit this page View Source GetAndUpdate(Updater, out T)

Atomically updates the stored value with the results of applying the given function, returning the original value.

Declaration
public void GetAndUpdate(Atomic<T>.Updater updater, out T result)
Parameters Type Name Description Atomic<T>.Updater updater

A side-effect-free function.

T result

The original value.

Exceptions | Edit this page View Source Read(out T)

Performs atomic read.

Declaration
public void Read(out T result)
Parameters Type Name Description T result

The result of atomic read.

| Edit this page View Source Swap(ref Atomic<T>)

Swaps the value stored in this container and the given value atomically.

Declaration
public void Swap(ref Atomic<T> other)
Parameters Type Name Description Atomic<T> other

The container for the value.

| Edit this page View Source Swap(ref T)

Swaps the value stored in this container and the given value atomically.

Declaration
public void Swap(ref T other)
Parameters Type Name Description T other

The managed pointer to the value to swap.

| Edit this page View Source ToString()

Converts the stored value into string atomically.

Declaration
public override string? ToString()
Returns Type Description string

The string returned from ToString() method called on the stored value.

Overrides | Edit this page View Source UpdateAndGet(Updater, out T)

Atomically updates the stored value with the results of applying the given function, returning the updated value.

Declaration
public void UpdateAndGet(Atomic<T>.Updater updater, out T result)
Parameters Type Name Description Atomic<T>.Updater updater

A side-effect-free function.

T result

The updated value.

Exceptions | Edit this page View Source Write(in T)

Performs atomic write.

Declaration
public void Write(in T newValue)
Parameters Type Name Description T newValue

The value to be stored into this container.

Implements Extension Methods

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4