Skip to content

Commit

Permalink
Make evthread_use_pthreads() actually return 0 on success.
Browse files Browse the repository at this point in the history
svn:r1356
  • Loading branch information
nmathewson committed Jul 17, 2009
1 parent ed03829 commit 4ba6eda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions evthread_pthread.c
Expand Up @@ -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;
}
3 changes: 2 additions & 1 deletion test/regress_pthread.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 4ba6eda

Please sign in to comment.