Make evthread_use_pthreads() actually return 0 on success.

svn:r1356
This commit is contained in:
Nick Mathewson 2009-07-17 20:22:56 +00:00
parent ed038295cd
commit 4ba6eda48f
2 changed files with 7 additions and 4 deletions

View File

@ -84,13 +84,15 @@ int
evthread_use_pthreads(void) evthread_use_pthreads(void)
{ {
/* Set ourselves up to get recursive locks. */ /* Set ourselves up to get recursive locks. */
pthread_mutexattr_init(&attr_recursive); if (pthread_mutexattr_init(&attr_recursive))
pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE); return -1;
if (pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE))
return -1;
evthread_set_lock_create_callbacks( evthread_set_lock_create_callbacks(
evthread_posix_lock_create, evthread_posix_lock_create,
evthread_posix_lock_free); evthread_posix_lock_free);
evthread_set_locking_callback(evthread_posix_lock); evthread_set_locking_callback(evthread_posix_lock);
evthread_set_id_callback(evthread_posix_get_id); evthread_set_id_callback(evthread_posix_get_id);
return -1; return 0;
} }

View File

@ -130,7 +130,8 @@ regress_threads(void *arg)
pthread_mutex_init(&count_lock, NULL); pthread_mutex_init(&count_lock, NULL);
evthread_use_pthreads(); if (evthread_use_pthreads()<0)
tt_abort_msg("Couldn't initialize pthreads!");
base = event_base_new(); base = event_base_new();
if (evthread_make_base_notifiable(base)<0) { if (evthread_make_base_notifiable(base)<0) {