FSharpx.Async


AutoCancelAgent<'T>

Namespace: FSharpx.Control

Wrapper for the standard F# agent (MailboxProcessor) that supports stopping of the agent's body using the IDisposable interface (the type automatically creates a cancellation token)

Instance members

Instance memberDescription
add_Error(arg1)
Signature: Handler<Exception> -> unit

Occurs when the execution of the agent results in an exception.

CurrentQueueLength
Signature: int

Returns the number of unprocessed messages in the message queue of the agent.

CompiledName: get_CurrentQueueLength

Error
Signature: IEvent<Handler<Exception>,Exception>

Occurs when the execution of the agent results in an exception.

CompiledName: get_Error

Post(m)
Signature: m:'T -> unit

Posts a message to the message queue of the MailboxProcessor, asynchronously.

PostAndAsyncReply(buildMessage, timeout)
Signature: (buildMessage:(AsyncReplyChannel<'?7439> -> 'T) * timeout:int option) -> Async<'?7439>

Posts a message to an agent and await a reply on the channel, asynchronously.

PostAndReply(buildMessage, timeout)
Signature: (buildMessage:(AsyncReplyChannel<'?7433> -> 'T) * timeout:int option) -> '?7433

Posts a message to an agent and await a reply on the channel, synchronously.

PostAndTryAsyncReply(...)
Signature: (buildMessage:(AsyncReplyChannel<'?7436> -> 'T) * timeout:int option) -> Async<'?7436 option>

Like PostAndAsyncReply, but returns None if no reply within the timeout period.

Receive(timeout)
Signature: (timeout:int option) -> Async<'T>

Waits for a message. This will consume the first message in arrival order.

remove_Error(arg1)
Signature: Handler<Exception> -> unit

Occurs when the execution of the agent results in an exception.

Scan(scanner, timeout)
Signature: (scanner:('T -> Async<'?7420> option) * timeout:int option) -> Async<'?7420>

Scans for a message by looking through messages in arrival order until scanner returns a Some value. Other messages remain in the queue.

TryPostAndReply(buildMessage, timeout)
Signature: (buildMessage:(AsyncReplyChannel<'?7423> -> 'T) * timeout:int option) -> '?7423 option

Like PostAndReply, but returns None if no reply within the timeout period.

TryReceive(timeout)
Signature: (timeout:int option) -> Async<'T option>

Waits for a message. This will consume the first message in arrival order.

TryScan(scanner, timeout)
Signature: (scanner:('T -> Async<'?7428> option) * timeout:int option) -> Async<'?7428 option>

Scans for a message by looking through messages in arrival order until scanner returns a Some value. Other messages remain in the queue.

Static members

Static memberDescription
Start(f)
Signature: (f:(MailboxProcessor<'T> -> Async<unit>)) -> AutoCancelAgent<'T>

Start a new disposable agent using the specified body function (the method creates a new cancellation token for the agent)

Fork me on GitHub