aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat_threads.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-08-12 10:49:19 -0400
committerNick Mathewson <nickm@torproject.org>2015-08-18 08:56:23 -0400
commit9ec94f1d22a87fbf86f721c6106f78f85b8be33c (patch)
tree9f2e36dad0208158c77be8a986e49973a4401988 /src/common/compat_threads.h
parente2a6a7ec6178834c3de7a3be614679120e2c00c8 (diff)
downloadtor-9ec94f1d22a87fbf86f721c6106f78f85b8be33c.tar.gz
tor-9ec94f1d22a87fbf86f721c6106f78f85b8be33c.zip
Use thread-local storage to block event_queue recursion.
Diffstat (limited to 'src/common/compat_threads.h')
-rw-r--r--src/common/compat_threads.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h
index acf3083f37..a1b5056a40 100644
--- a/src/common/compat_threads.h
+++ b/src/common/compat_threads.h
@@ -111,5 +111,18 @@ typedef struct alert_sockets_s {
int alert_sockets_create(alert_sockets_t *socks_out, uint32_t flags);
void alert_sockets_close(alert_sockets_t *socks);
+typedef struct tor_threadlocal_s {
+#ifdef _WIN32
+ DWORD index;
+#else
+ pthread_key_t key;
+#endif
+} tor_threadlocal_t;
+
+int tor_threadlocal_init(tor_threadlocal_t *threadlocal);
+void tor_threadlocal_destroy(tor_threadlocal_t *threadlocal);
+void *tor_threadlocal_get(tor_threadlocal_t *threadlocal);
+void tor_threadlocal_set(tor_threadlocal_t *threadlocal, void *value);
+
#endif