nostrdb: fix windows build

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-04-12 12:34:09 -07:00
committed by Daniel D’Aquino
parent de0935582c
commit 3186b0e1d3
10 changed files with 108 additions and 30 deletions

View File

@@ -55,7 +55,7 @@ static int threadpool_init(struct threadpool *tp, int num_threads,
return 0;
}
if (pthread_create(&t->thread_id, NULL, thread_fn, t) != 0) {
if (THREAD_CREATE(t->thread_id, thread_fn, t) != 0) {
fprintf(stderr, "threadpool_init: failed to create thread\n");
return 0;
}
@@ -90,9 +90,9 @@ static inline void threadpool_destroy(struct threadpool *tp)
for (int i = 0; i < tp->num_threads; i++) {
t = &tp->pool[i];
if (!prot_queue_push(&t->inbox, tp->quit_msg)) {
pthread_exit(&t->thread_id);
THREAD_TERMINATE(t->thread_id);
} else {
pthread_join(t->thread_id, NULL);
THREAD_FINISH(t->thread_id);
}
prot_queue_destroy(&t->inbox);
free(t->qmem);