]> granicus.if.org Git - libevent/commitdiff
Make evthread_use_pthreads() actually return 0 on success.
authorNick Mathewson <nickm@torproject.org>
Fri, 17 Jul 2009 20:22:56 +0000 (20:22 +0000)
committerNick Mathewson <nickm@torproject.org>
Fri, 17 Jul 2009 20:22:56 +0000 (20:22 +0000)
svn:r1356

evthread_pthread.c
test/regress_pthread.c

index ff8ffe65815fc412b94ff04748ce7e3fd46f1f40..0263c74723e968405b28fa0d905e7296ce0574af 100644 (file)
@@ -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;
 }
index 84e7c771038a9fca8a47a617cb48af5e91411ebf..3010e4e7c1c2d1bc9fe03c1a43bc25d693646caa 100644 (file)
@@ -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) {