diff options
Diffstat (limited to 'src/core/pollable.h')
| -rw-r--r-- | src/core/pollable.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/core/pollable.h b/src/core/pollable.h index 50ec9bf6..a71a9693 100644 --- a/src/core/pollable.h +++ b/src/core/pollable.h @@ -1,5 +1,5 @@ // -// Copyright 2017 Garrett D'Amore <garrett@damore.org> +// Copyright 2020 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 @@ -13,8 +13,6 @@ #include "core/defs.h" #include "core/list.h" -// For the sake of simplicity, we just maintain a single global timer thread. - typedef struct nni_pollable nni_pollable; extern int nni_pollable_alloc(nni_pollable **); @@ -23,4 +21,16 @@ extern void nni_pollable_raise(nni_pollable *); extern void nni_pollable_clear(nni_pollable *); extern int nni_pollable_getfd(nni_pollable *, int *); +// nni_pollable implementation details are private. Only here for inlining. +// We have joined to the write and read file descriptors into a 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 |
