From 7bd3eb3b1ad4209ac4cf4b46f849213d46bc33aa Mon Sep 17 00:00:00 2001 From: David Timber Date: Mon, 17 Aug 2020 18:16:49 +0930 Subject: Employ pthsem ... * Use uint8_t array for hardcoded binary data * Add proone-ipaddr-arr to hardcode DoT servers * Convert X509 data * Brought back M68k and ARC archs just in case * Add CLOCK_REALTIME in prne_mbedtls_entropy_proc_src_f for more entropy * Remove installation of signal handlers. Use sigwait() instead * Bugfix: prne_rnd_anum_str() returned null characters * Add prne_dbgpf() and prne_dbgperr() * prne_assert(): put errno into a register so it's visible in the core dump --- src/pth.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/pth.h (limited to 'src/pth.h') diff --git a/src/pth.h b/src/pth.h new file mode 100644 index 0000000..172e6cf --- /dev/null +++ b/src/pth.h @@ -0,0 +1,31 @@ +#pragma once +#include + +#include + + +struct prne_worker { + void *ctx; + void *(*entry)(void*); + void (*fin)(void*); + void (*free_ctx)(void*); + pth_t pth; +}; +typedef struct prne_worker prne_worker_t; + +struct prne_pth_cv { + pth_mutex_t *lock; + pth_cond_t *cond; + bool broadcast; +}; +typedef struct prne_pth_cv prne_pth_cv_t; + + +void prne_init_worker (prne_worker_t *w); +void prne_free_worker (prne_worker_t *w); +void prne_fin_worker (prne_worker_t *w); + +bool prne_pth_cv_notify (prne_pth_cv_t *cv); +bool prne_pth_cond_timedwait (prne_pth_cv_t *cv, const struct timespec *timeout, bool *to_reached); +int prne_unint_pth_poll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout); +void prne_unint_pth_nanosleep (struct timespec dur); -- cgit