summaryrefslogtreecommitdiff
path: root/src/lib/thread/threads.h
diff options
context:
space:
mode:
authorDaniel Pinto <danielpinto52@gmail.com>2020-10-31 18:33:33 +0000
committerDaniel Pinto <danielpinto52@gmail.com>2020-11-01 03:10:25 +0000
commitf3b9be4422a08b6066bdb93874a5023e7c11ce9e (patch)
treeb0d36b44ebcc2f6675a9f8f164b1d6088ca52826 /src/lib/thread/threads.h
parent6e25c49f7615f5e921f4d4ec281c225a720f8289 (diff)
downloadtor-f3b9be4422a08b6066bdb93874a5023e7c11ce9e.tar.gz
tor-f3b9be4422a08b6066bdb93874a5023e7c11ce9e.zip
Implement WIN32 tor_cond_wait using condition variables #30187
Fix bug where running a relay on Windows would use 100% CPU after some time. Makes Windows >= Vista the required Windows version to build and run tor.
Diffstat (limited to 'src/lib/thread/threads.h')
-rw-r--r--src/lib/thread/threads.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/lib/thread/threads.h b/src/lib/thread/threads.h
index fcc0c23a87..ead4dc3874 100644
--- a/src/lib/thread/threads.h
+++ b/src/lib/thread/threads.h
@@ -42,12 +42,7 @@ 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;
+ CONDITION_VARIABLE cond;
#else
#error no known condition implementation.
#endif /* defined(USE_PTHREADS) || ... */