LanguageExt.Core

LanguageExt.Core Concurrency AtomQue

Contents

delegate AtomDequeuedEvent <in A> Source #

Event thrown when an item is dequeued from an AtomQue

Parameters

type A

Item that was dequeued

delegate AtomEnqueuedEvent <in A> Source #

Event thrown when an item is enqueued to an AtomQue

Parameters

type A

Item that was enqueued

class AtomQue <A> Source #

Atoms provide a way to manage shared, synchronous, independent state without locks. AtomQue wraps the language-ext Que, and makes sure all operations are atomic and thread-safe without resorting to locking.

See the concurrency section of the wiki for more info.

Parameters

type A

Item value type

Properties

property object? Case Source #

Reference version for use in pattern-matching

Empty collection     = null
Singleton collection = A
More                 = (A, Seq<A>)   -- head and tail

var res = list.Case switch
{

   (var x, var xs) => ...,
   A value         => ...,
   _               => ...
}

property bool IsEmpty Source #

Is the queue empty

property int Count Source #

Number of items in the queue

property int Length Source #

Alias of Count

Methods

method Unit Do (Action<A> f) Source #

Impure iteration of the bound value in the structure

Parameters

returns

Returns the original unmodified structure

method Unit Clear () Source #

Clears the queue atomically

method Option<A> Peek () Source #

Look at the item at the front of the queue, if it exists.

Parameters

returns

The item at the front of the queue, if it exists. None otherwise.

method Option<A> Dequeue () Source #

Removes the item from the front of the queue atomically

Parameters

returns

The item that was at the front of the queue (if it existed, None otherwise)

method A DequeueUnsafe () Source #

Removes the item from the front of the queue atomically

Parameters

returns

The item that was at the front of the queue, or an InvalidOperationException exception

method Unit Enqueue (A value) Source #

Add an item to the end of the queue atomically

Parameters

param value

Value to add to the queue

method Seq<A> ToSeq () Source #

method IEnumerable<A> AsEnumerable () Source #

method IEnumerator<A> GetEnumerator () Source #

method Unit Append (Que<A> rhs) Source #

method Unit Append (AtomQue<A> rhs) Source #

method int GetHashCode () Source #

method bool Equals (object obj) Source #

method bool Equals (AtomQue<A>? other) Source #

method bool Equals (Que<A> other) Source #

Operators

operator == (AtomQue<A> lhs, AtomQue<A> rhs) Source #

operator == (AtomQue<A> lhs, Que<A> rhs) Source #

operator == (Que<A> lhs, AtomQue<A> rhs) Source #

operator != (AtomQue<A> lhs, AtomQue<A> rhs) Source #

operator != (Que<A> lhs, AtomQue<A> rhs) Source #

operator != (AtomQue<A> lhs, Que<A> rhs) Source #