summaryrefslogtreecommitdiff
path: root/src/common/compat_pthreads.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-09-25 11:05:27 -0400
committerNick Mathewson <nickm@torproject.org>2015-01-14 11:05:54 -0500
commitb2db3fb4627c8bd06489334f69b6d36d60fb418d (patch)
tree3bee765e610e678cb9aecef34ef0d171e4581362 /src/common/compat_pthreads.c
parent4abbf13f99dac9e15856dc4e458a8c9525acab4d (diff)
downloadtor-b2db3fb4627c8bd06489334f69b6d36d60fb418d.tar.gz
tor-b2db3fb4627c8bd06489334f69b6d36d60fb418d.zip
Documentation for new workqueue and condition and locking stuff
Diffstat (limited to 'src/common/compat_pthreads.c')
-rw-r--r--src/common/compat_pthreads.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/compat_pthreads.c b/src/common/compat_pthreads.c
index 59b54a600a..a2e406521f 100644
--- a/src/common/compat_pthreads.c
+++ b/src/common/compat_pthreads.c
@@ -164,6 +164,7 @@ tor_get_thread_id(void)
/* Conditions. */
+/** Initialize an already-allocated condition variable. */
int
tor_cond_init(tor_cond_t *cond)
{
@@ -173,7 +174,9 @@ tor_cond_init(tor_cond_t *cond)
}
return 0;
}
-/** Release all resources held by <b>cond</b>. */
+
+/** Release all resources held by <b>cond</b>, but do not free <b>cond</b>
+ * itself. */
void
tor_cond_uninit(tor_cond_t *cond)
{
@@ -183,7 +186,11 @@ tor_cond_uninit(tor_cond_t *cond)
}
}
/** Wait until one of the tor_cond_signal functions is called on <b>cond</b>.
- * All waiters on the condition must wait holding the same <b>mutex</b>.
+ * (If <b>tv</b> is set, and that amount of time passes with no signal to
+ * <b>cond</b>, return anyway. All waiters on the condition must wait holding
+ * the same <b>mutex</b>. All signallers should hold that mutex. The mutex
+ * needs to have been allocated with tor_mutex_init_for_cond().
+ *
* Returns 0 on success, -1 on failure, 1 on timeout. */
int
tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex, const struct timeval *tv)