diff options
Diffstat (limited to 'src/common/compat_threads.h')
-rw-r--r-- | src/common/compat_threads.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h index f43e74ab8f..bbd782fd45 100644 --- a/src/common/compat_threads.h +++ b/src/common/compat_threads.h @@ -57,10 +57,25 @@ void tor_threads_init(void); void set_main_thread(void); int in_main_thread(void); -typedef struct tor_cond_t tor_cond_t; +typedef struct tor_cond_t { +#ifdef USE_PTHREADS + pthread_cond_t cond; +#elif defined(USE_WIN32_THREADS) + HANDLE event; + + CRITICAL_SECTION lock; + int n_waiting; + int n_to_wake; + int generation; +#else +#error no known condition implementation. +#endif +} tor_cond_t; + tor_cond_t *tor_cond_new(void); void tor_cond_free(tor_cond_t *cond); -int tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex); +int tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex, + const struct timeval *tv); void tor_cond_signal_one(tor_cond_t *cond); void tor_cond_signal_all(tor_cond_t *cond); |