# How do timeouts work in the C API?

**URL:** <https://forums.foundationdb.org/t/how-do-timeouts-work-in-the-c-api/1322>\
**Category:** Using FoundationDB\
**Created:** [April 20, 2019, 10:42pm UTC](https://forums.foundationdb.org/t/how-do-timeouts-work-in-the-c-api/1322 "2019-04-20T22:42:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonahwest](https://avatars.discourse-cdn.com/v4/letter/j/90db22/32.png) [@jonahwest](https://forums.foundationdb.org/u/jonahwest)\
**Post date:** [April 20, 2019, 10:42pm UTC](https://forums.foundationdb.org/t/how-do-timeouts-work-in-the-c-api/1322/1 "2019-04-20T22:42:23Z")

</div>

When the database is not available, the client will wait forever without a timeout. Specifically in `fdb_future_block_until_ready()`. It also seems that there is no mention of timeouts in the API documentation.

How can I set a timeout for an operation in the C API?

---

<div class="post-metadata">

**Author:** ![ryanworl](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/ryanworl/32/440_2.png) [@ryanworl](https://forums.foundationdb.org/u/ryanworl)\
**Post date:** [April 20, 2019, 10:59pm UTC](https://forums.foundationdb.org/t/how-do-timeouts-work-in-the-c-api/1322/2 "2019-04-20T22:59:30Z")

</div>

The timeout can be set at the transaction level using `fdb_transaction_set_option()`. Your future will fail (and return) when the transaction times out and the `fdb_future_block_until_ready()` API says you must check if the call resulted in an error every time regardless.
