diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-25 23:31:40 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-14 11:09:51 -0500 |
commit | 9fdc0d059456146722dc81f2b58672b533a2bb71 (patch) | |
tree | 54ee4efb91186f6b0195f56ac7d6f765717864fd /src/common/compat_winthreads.c | |
parent | d850ec8574761c0279df53f3b7a9811d1dab430f (diff) | |
download | tor-9fdc0d059456146722dc81f2b58672b533a2bb71.tar.gz tor-9fdc0d059456146722dc81f2b58672b533a2bb71.zip |
Fix windows compilation of condition code
Diffstat (limited to 'src/common/compat_winthreads.c')
-rw-r--r-- | src/common/compat_winthreads.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/common/compat_winthreads.c b/src/common/compat_winthreads.c index 0ab26b7ebd..e19b1cae85 100644 --- a/src/common/compat_winthreads.c +++ b/src/common/compat_winthreads.c @@ -9,6 +9,10 @@ #include "util.h" #include "container.h" #include "torlog.h" +#include <process.h> + +/* This value is more or less total cargo-cult */ +#define SPIN_COUNT 2000 /** Minimalist interface to run a void function in the background. On * Unix calls fork, on win32 calls beginthread. Returns -1 on failure. @@ -108,7 +112,6 @@ tor_cond_signal_impl(tor_cond_t *cond, int broadcast) cond->generation++; SetEvent(cond->event); LeaveCriticalSection(&cond->lock); - return 0; } void tor_cond_signal_one(tor_cond_t *cond) @@ -122,15 +125,15 @@ tor_cond_signal_all(tor_cond_t *cond) } int -tor_cond_wait(tor_cond_t *cond, tor_mutex_t *lock, const struct timeval *tv) +tor_cond_wait(tor_cond_t *cond, tor_mutex_t *lock_, const struct timeval *tv) { - CRITICAL_SECTION *lock = &lock->mutex; + CRITICAL_SECTION *lock = &lock_->mutex; int generation_at_start; int waiting = 1; int result = -1; DWORD ms = INFINITE, ms_orig = INFINITE, startTime, endTime; if (tv) - ms_orig = ms = evutil_tv_to_msec_(tv); + ms_orig = ms = tv->tv_sec*1000 + (tv->tv_usec+999)/1000; EnterCriticalSection(&cond->lock); ++cond->n_waiting; |