diff options
Diffstat (limited to 'src/wg.h')
-rw-r--r-- | src/wg.h | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -21,18 +21,17 @@ #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. */ +/* When you call wg_wait, the waitgroup is destroyed. You must + * re-wg_init it if you want to reuse it. */ struct wg { int count; pthread_mutex_t lock; - int fd_wait; - int fd_signal; + int fd_threads[2]; + pthread_t gc; }; void wg_init(struct wg *); -void wg_add(struct wg *, unsigned int); -void wg_sub(struct wg *, unsigned int); +void wg_add(struct wg *); +void wg_sub(struct wg *); void wg_wait(struct wg*); |