libxtc 0.4.0
Async concurrency for C: Tokio + Seastar + BEAM, in one library
Loading...
Searching...
No Matches
future_int.h
1/*-
2 * Copyright (c) 2026, The XTC Project
3 * Use of this source code is governed by the ISC License.
4 *
5 * src/inc/future_int.h
6 * Internal (NOT public) future helper used by the async batch engine
7 * to own the completion token's lifetime across teardown. See
8 * src/ptc/future.c for the contract and src/ptc/batch.c for the one
9 * consumer.
10 */
11#ifndef XTC_FUTURE_INT_H
12#define XTC_FUTURE_INT_H
13
14#include "xtc_future.h"
15
16/*
17 * Consume a future WITHOUT waiting: release the read half's reference
18 * and free the handle, exactly as a completed xtc_future_wait would,
19 * but without blocking. Safe whether the paired promise is already set,
20 * never set (still outstanding), or dropped -- the cell is reference
21 * counted, so a later xtc_promise_set / xtc_promise_drop is a safe
22 * refcount operation on the (possibly last-ref-freed) cell, never a
23 * UAF. The handle must not be used after this (it is freed). NULL is a
24 * no-op.
25 */
26void __xtc_future_discard(xtc_future_t *fut);
27
28#endif /* XTC_FUTURE_INT_H */