diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-24 20:43:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-14 11:01:19 -0500 |
commit | 51bc0e7f3d612b099382500b434d31f179eaa8a8 (patch) | |
tree | 5efe2a9786609a33876e35411bbf7f0df9b37f76 /src/common/compat_threads.h | |
parent | c7eebe237ddf0555a99b2ef10fd95def2a4bbbd4 (diff) | |
download | tor-51bc0e7f3d612b099382500b434d31f179eaa8a8.tar.gz tor-51bc0e7f3d612b099382500b434d31f179eaa8a8.zip |
Isolate the "socketpair or a pipe" logic for alerting main thread
This way we can use the linux eventfd extension where available.
Using EVFILT_USER on the BSDs will be a teeny bit trickier, and will
require libevent hacking.
Diffstat (limited to 'src/common/compat_threads.h')
-rw-r--r-- | src/common/compat_threads.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h index 581d8dd7b9..b053136c15 100644 --- a/src/common/compat_threads.h +++ b/src/common/compat_threads.h @@ -82,4 +82,15 @@ 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); +/** DOCDOC */ +typedef struct alert_sockets_s { + /*XXX needs a better name */ + tor_socket_t read_fd; + tor_socket_t write_fd; + int (*alert_fn)(tor_socket_t write_fd); + int (*drain_fn)(tor_socket_t read_fd); +} alert_sockets_t; + +int alert_sockets_create(alert_sockets_t *socks_out); + #endif |