Skip to content

Implement timeout #63

@sgerbino

Description

@sgerbino

timeout

Fail a task if it doesn't complete within a duration.

Behavior:

  • Starts the task and a timer concurrently
  • If task completes first, returns its result
  • If timer fires first, requests stop for the task and returns error condition capy::cond::timeout

Real-world use cases:

Use Case Description
SLA enforcement Ensure responses within promised latency
Deadlock prevention Abort operations that hang indefinitely
Resource protection Prevent slow clients from holding resources
User experience Show timeout message rather than hanging UI
auto[ec, n] = co_await timeout( sock.read_some( buf ), 50ms );

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions