From: Nick Mathewson Date: Fri, 17 Jul 2009 20:22:56 +0000 (+0000) Subject: Make evthread_use_pthreads() actually return 0 on success. X-Git-Tag: release-2.0.3-alpha~173 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ba6eda48fb8cc451f649a19f5a3d2006995073d;p=libevent Make evthread_use_pthreads() actually return 0 on success. svn:r1356 --- diff --git a/evthread_pthread.c b/evthread_pthread.c index ff8ffe65..0263c747 100644 --- a/evthread_pthread.c +++ b/evthread_pthread.c @@ -84,13 +84,15 @@ int evthread_use_pthreads(void) { /* Set ourselves up to get recursive locks. */ - pthread_mutexattr_init(&attr_recursive); - pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE); + if (pthread_mutexattr_init(&attr_recursive)) + return -1; + if (pthread_mutexattr_settype(&attr_recursive, PTHREAD_MUTEX_RECURSIVE)) + return -1; evthread_set_lock_create_callbacks( evthread_posix_lock_create, evthread_posix_lock_free); evthread_set_locking_callback(evthread_posix_lock); evthread_set_id_callback(evthread_posix_get_id); - return -1; + return 0; } diff --git a/test/regress_pthread.c b/test/regress_pthread.c index 84e7c771..3010e4e7 100644 --- a/test/regress_pthread.c +++ b/test/regress_pthread.c @@ -130,7 +130,8 @@ regress_threads(void *arg) 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(); if (evthread_make_base_notifiable(base)<0) {