diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-28 08:49:07 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-28 08:49:07 -0400 |
commit | 544ab27a949406628809869111b7288017a5bcb1 (patch) | |
tree | 911f21717353327dad7ae296cef4ca0a893839a8 /src/common/compat_threads.h | |
parent | 0b7452eeb2f2dee7acefee2d3ca2cb402a877ea1 (diff) | |
download | tor-544ab27a949406628809869111b7288017a5bcb1.tar.gz tor-544ab27a949406628809869111b7288017a5bcb1.zip |
Extract the alert-socket code into lib/net.
This code was in compat_threads, since it was _used_ for efficiently
notifying the main libevent thread from another thread. But in
spite of its usage, it's fundamentally a part of the network code.
Diffstat (limited to 'src/common/compat_threads.h')
-rw-r--r-- | src/common/compat_threads.h | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h index d1fdfc96cc..69350421b5 100644 --- a/src/common/compat_threads.h +++ b/src/common/compat_threads.h @@ -52,32 +52,6 @@ int tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex, void tor_cond_signal_one(tor_cond_t *cond); void tor_cond_signal_all(tor_cond_t *cond); -/** Helper type used to manage waking up the main thread while it's in - * the libevent main loop. Used by the work queue code. */ -typedef struct alert_sockets_s { - /* XXXX This structure needs a better name. */ - /** Socket that the main thread should listen for EV_READ events on. - * Note that this socket may be a regular fd on a non-Windows platform. - */ - tor_socket_t read_fd; - /** Socket to use when alerting the main thread. */ - tor_socket_t write_fd; - /** Function to alert the main thread */ - int (*alert_fn)(tor_socket_t write_fd); - /** Function to make the main thread no longer alerted. */ - int (*drain_fn)(tor_socket_t read_fd); -} alert_sockets_t; - -/* Flags to disable one or more alert_sockets backends. */ -#define ASOCKS_NOEVENTFD2 (1u<<0) -#define ASOCKS_NOEVENTFD (1u<<1) -#define ASOCKS_NOPIPE2 (1u<<2) -#define ASOCKS_NOPIPE (1u<<3) -#define ASOCKS_NOSOCKETPAIR (1u<<4) - -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; |