Header menu logo TDesu.FSharp

Timeout Module

Timeout combinators — enforce deadlines on async operations.

Functions and values

Function or value Description

Timeout.after duration work

Full Usage: Timeout.after duration work

Parameters:
    duration : TimeSpan - Maximum time allowed before the operation is cancelled.
    work : CancellationToken -> Task<'T> - Async work that receives a cancellation token linked to the deadline.

Returns: Task<'T>

Runs work with a hard deadline. Throws TimeoutException if exceeded. Propagates CancellationToken so underlying work can cooperatively stop.

duration : TimeSpan

Maximum time allowed before the operation is cancelled.

work : CancellationToken -> Task<'T>

Async work that receives a cancellation token linked to the deadline.

Returns: Task<'T>
TimeoutException When the operation exceeds duration.

Timeout.afterLinked duration parentCt work

Full Usage: Timeout.afterLinked duration parentCt work

Parameters:
Returns: Task<'T>

Runs work with a deadline, linked to a parent cancellation token. Maximum time allowed before the operation is cancelled. Parent token that can also trigger cancellation. Async work that receives a cancellation token linked to both the deadline and the parent token.

duration : TimeSpan
parentCt : CancellationToken
work : CancellationToken -> Task<'T>
Returns: Task<'T>

Type something to start searching.