From ff5063ad0e7902ce59864a466bd9d8d606d788e4 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Sun, 24 Sep 2017 14:34:03 +0200 Subject: ipcpd: Add threadpool manager to DHT This adds a threadpool manager to the DHT. This was needed because the detached thread could cause a data race on shutdown. The threadpool manager is revised to allow multiple instances in a single program. The irmd and ipcp now store commands in a buffer (list) instead of a single buffer before passing it to handler threads. --- include/ouroboros/tpm.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/ouroboros/tpm.h b/include/ouroboros/tpm.h index dc57f485..74e45035 100644 --- a/include/ouroboros/tpm.h +++ b/include/ouroboros/tpm.h @@ -25,22 +25,25 @@ #include -int tpm_init(size_t min, - size_t inc, - void * (* func)(void *)); +struct tpm; -int tpm_start(void); +struct tpm * tpm_create(size_t min, + size_t inc, + void * (* func)(void *), + void * o); -void tpm_stop(void); +void tpm_destroy(struct tpm * tpm); -void tpm_fini(void); +int tpm_start(struct tpm * tpm); -bool tpm_check(void); +void tpm_stop(struct tpm * tpm); -void tpm_exit(void); +bool tpm_check(struct tpm * tpm); -void tpm_dec(void); +void tpm_exit(struct tpm * tpm); -void tpm_inc(void); +void tpm_dec(struct tpm * tpm); + +void tpm_inc(struct tpm * tpm); #endif /* OUROBOROS_LIB_TPM_H */ -- cgit v1.2.3