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) {