r13631@catbus: nickm | 2007-07-06 10:17:22 -0400

Try to fix win32 build again.


svn:r10750
This commit is contained in:
Nick Mathewson 2007-07-06 14:17:30 +00:00
parent bbc7cf86d5
commit 73b4428a8b

View File

@ -1498,10 +1498,8 @@ struct tor_mutex_t {
tor_mutex_t * tor_mutex_t *
tor_mutex_new(void) tor_mutex_new(void)
{ {
void *r;
tor_mutex_t *m = tor_malloc_zero(sizeof(tor_mutex_t)); tor_mutex_t *m = tor_malloc_zero(sizeof(tor_mutex_t));
r = InitializeCriticalSection(&m->mutex); InitializeCriticalSection(&m->mutex);
tor_assert(r != NULL);
return m; return m;
} }
void void
@ -1653,10 +1651,7 @@ tor_cond_t *
tor_cond_new(void) tor_cond_new(void)
{ {
tor_cond_t *cond = tor_malloc_zero(sizeof(tor_cond_t)); tor_cond_t *cond = tor_malloc_zero(sizeof(tor_cond_t));
if (!InitializeCriticalSection(&cond->mutex)) { InitializeCriticalSection(&cond->mutex);
tor_free(cond);
return NULL;
}
cond->events = smartlist_create(); cond->events = smartlist_create();
return cond; return cond;
} }
@ -1669,7 +1664,7 @@ tor_cond_free(tor_cond_t *cond)
smartlist_free(cond->events); smartlist_free(cond->events);
tor_free(cond); tor_free(cond);
} }
void int
tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex) tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex)
{ {
HANDLE event; HANDLE event;
@ -1703,6 +1698,7 @@ tor_cond_wait(tor_cond_t *cond, tor_mutex_t *mutex)
case WAIT_FAILED: case WAIT_FAILED:
log_warn(LD_GENERAL, "Failed to acquire mutex: %d",(int) GetLastError()); log_warn(LD_GENERAL, "Failed to acquire mutex: %d",(int) GetLastError());
} }
return 0;
} }
void void
tor_cond_signal_one(tor_cond_t *cond) tor_cond_signal_one(tor_cond_t *cond)
@ -1712,7 +1708,7 @@ tor_cond_signal_one(tor_cond_t *cond)
EnterCriticalSection(&cond->mutex); EnterCriticalSection(&cond->mutex);
if ((event = smartlist_pop_last(cond->events)) if ((event = smartlist_pop_last(cond->events)))
SetEvent(event); SetEvent(event);
LeaveCriticalSection(&cond->mutex); LeaveCriticalSection(&cond->mutex);