Debian Codegraph @

src/dex-future-private.h

raw symbols SCIP
1 /*
2 * dex-future-private.h
3 *
4 * Copyright 2022 Christian Hergert <[email protected]>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * SPDX-License-Identifier: LGPL-2.1-or-later
20 */
21
22 #pragma once
23
24 #ifndef PACKAGE_VERSION
25 # error "config.h must be included before dex-future-private.h"
26 #endif
27
28 #include "dex-future.h"
29 #include "dex-object-private.h"
30
31 G_BEGIN_DECLS
32
33 #define DEX_FUTURE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST(klass, DEX_TYPE_FUTURE, DexFutureClass))
34 #define DEX_FUTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, DEX_TYPE_FUTURE, DexFutureClass))
35
36 typedef struct _DexScheduler DexScheduler;
37
38 typedef struct _DexFuture
39 {
40 DexObject parent_instance;
41 GValue resolved;
42 GError *rejected;
43 GQueue chained;
44 GList task_group_link;
45 const char *name;
46 DexFutureStatus status : 2;
47 } DexFuture;
48
49 typedef struct _DexFutureClass
50 {
51 DexObjectClass parent_class;
52
53 gboolean (*propagate) (DexFuture *future,
54 DexFuture *completed);
55 void (*discard) (DexFuture *future);
56 } DexFutureClass;
57
58 void dex_future_chain (DexFuture *future,
59 DexFuture *chained);
60 void dex_future_complete (DexFuture *future,
61 const GValue *value,
62 GError *error);
63 void dex_future_complete_steal (DexFuture *future,
64 GValue *value,
65 GError *error);
66 void dex_future_complete_from (DexFuture *future,
67 DexFuture *completed);
68 void dex_future_discard (DexFuture *future,
69 DexFuture *chained);
70 const GValue *dex_await_borrowed (DexFuture *future,
71 GError **error);
72 void dex_future_disown_full (DexFuture *future,
73 DexScheduler *scheduler);
74
75 G_END_DECLS