mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Make evthread_use_pthreads() actually return 0 on success.
svn:r1356
This commit is contained in:
parent
ed038295cd
commit
4ba6eda48f
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user