diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-23 01:15:30 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-14 10:49:59 -0500 |
commit | 65016304d23503e230e8b097b5cdc1e4897b9b57 (patch) | |
tree | 55dd1617de8d2994643a6e915bdd09a6165988d5 /src/common/compat_threads.c | |
parent | e865248156a8512d756be003118de446d29611d1 (diff) | |
download | tor-65016304d23503e230e8b097b5cdc1e4897b9b57.tar.gz tor-65016304d23503e230e8b097b5cdc1e4897b9b57.zip |
Add tor_cond_init/uninit
Diffstat (limited to 'src/common/compat_threads.c')
-rw-r--r-- | src/common/compat_threads.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/common/compat_threads.c b/src/common/compat_threads.c index 84a8a21fe2..e0cbf5c1d8 100644 --- a/src/common/compat_threads.c +++ b/src/common/compat_threads.c @@ -24,6 +24,23 @@ tor_mutex_free(tor_mutex_t *m) tor_free(m); } +tor_cond_t * +tor_cond_new(void) +{ + tor_cond_t *cond = tor_malloc(sizeof(tor_cond_t)); + if (tor_cond_init(cond)<0) + tor_free(cond); + return cond; +} +void +tor_cond_free(tor_cond_t *c) +{ + if (!c) + return; + tor_cond_uninit(c); + tor_free(c); +} + /** Identity of the "main" thread */ static unsigned long main_thread_id = -1; |