[tor-commits] [tor/master] Add comments for thread-local storage functions

nickm at torproject.org nickm at torproject.org
Tue Aug 18 13:10:55 UTC 2015


commit e8fe77530ad6238dc16781b0032899f3affa778f
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Aug 17 13:36:56 2015 -0400

    Add comments for thread-local storage functions
---
 src/common/compat_threads.h |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h
index a1b5056..9f34054 100644
--- a/src/common/compat_threads.h
+++ b/src/common/compat_threads.h
@@ -119,9 +119,26 @@ typedef struct tor_threadlocal_s {
 #endif
 } tor_threadlocal_t;
 
+/** Initialize a thread-local variable.
+ *
+ * After you call this function on a tor_threadlocal_t, you can call
+ * tor_threadlocal_set to change the current value of this variable for the
+ * current thread, and tor_threadlocal_get to retrieve the current value for
+ * the current thread.  Each thread has its own value.
+ **/
 int tor_threadlocal_init(tor_threadlocal_t *threadlocal);
+/**
+ * Release all resource associated with a thread-local variable.
+ */
 void tor_threadlocal_destroy(tor_threadlocal_t *threadlocal);
+/**
+ * Return the current value of a thread-local variable for this thread.
+ */
 void *tor_threadlocal_get(tor_threadlocal_t *threadlocal);
+/**
+ * Change the current value of a thread-local variable for this thread to
+ * <b>value</b>.
+ */
 void tor_threadlocal_set(tor_threadlocal_t *threadlocal, void *value);
 
 #endif





More information about the tor-commits mailing list