summaryrefslogtreecommitdiff
path: root/src/wg.h
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-04-12 00:01:27 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-12 00:01:27 -0400
commit24de3887e5e3bba2b8a4f60d1224ac927b98b1ed (patch)
tree20a27018a7fae78205e0bfee7fac4db4c82c0dea /src/wg.h
parentc8f6735fce3d7ba5aa8019775d26b6999ed5a344 (diff)
stuff
- fix memory leaks (except for those from libusb) - fix graceful shutdown - fix systemd weirdness
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*);