summaryrefslogtreecommitdiff
path: root/src/wg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wg.h')
-rw-r--r--src/wg.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/wg.h b/src/wg.h
index c7efcb2..b2eb4c4 100644
--- a/src/wg.h
+++ b/src/wg.h
@@ -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*);