blob: 777e8a3a76e2ab0ce837d04ab032019ce1ea1511 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#pragma once
#include <pthread.h>
/* Thread management tools modeled on https://golang.org/pkg/sync/#WaitGroup */
/* pthread_cond_t is overly complicated. Just use a self-pipe. */
struct wg {
int count;
pthread_mutex_t lock;
int fd_wait;
int fd_signal;
};
void wg_init(struct wg *);
void wg_add(struct wg *, unsigned int);
void wg_sub(struct wg *, unsigned int);
void wg_wait(struct wg*);
|