From 24de3887e5e3bba2b8a4f60d1224ac927b98b1ed Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 12 Apr 2016 00:01:27 -0400 Subject: stuff - fix memory leaks (except for those from libusb) - fix graceful shutdown - fix systemd weirdness --- src/wg.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/wg.h') 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 -/* 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*); -- cgit v1.2.3-54-g00ecf