blob: 1be8b034df3ba015a5510e2b9b8fbb988af13349 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//
// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt). A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//
#ifndef CORE_POLLABLE_H
#define CORE_POLLABLE_H
#include "defs.h"
#include "list.h"
#include "platform.h"
typedef struct nni_pollable nni_pollable;
extern void nni_pollable_raise(nni_pollable *);
extern void nni_pollable_clear(nni_pollable *);
extern nng_err nni_pollable_getfd(nni_pollable *, int *);
// nni_pollable implementation details are private. Only here for inlining.
// We have joined the write and read file descriptors into a single
// atomic 64, so we can update them together (and we can use cas to be sure
// that such updates are always safe.)
struct nni_pollable {
nni_atomic_u64 p_fds;
nni_atomic_bool p_raised;
};
extern void nni_pollable_init(nni_pollable *);
extern void nni_pollable_fini(nni_pollable *);
#endif // CORE_POLLABLE_H
|