From cb50f615d4902a0703a604bf64b1a5d014bcbb70 Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Tue, 11 Mar 2008 05:26:30 +0000 Subject: [PATCH] rename lock create callback functions; as suggested by nick svn:r691 --- event.c | 2 +- include/event2/thread.h | 11 ++++++++--- test/regress_pthread.c | 3 +-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/event.c b/event.c index 4924587f..da4929a2 100644 --- a/event.c +++ b/event.c @@ -1213,7 +1213,7 @@ evthread_set_id_callback(struct event_base *base, } void -evthread_set_create_callback(struct event_base *base, +evthread_set_lock_create_callbacks(struct event_base *base, void *(*alloc_fn)(void), void (*free_fn)(void *)) { #ifdef DISABLE_THREAD_SUPPORT diff --git a/include/event2/thread.h b/include/event2/thread.h index 1bd44878..5de97bc4 100644 --- a/include/event2/thread.h +++ b/include/event2/thread.h @@ -63,10 +63,15 @@ extern "C" { #define EVTHREAD_READ 0x08 /** - Sets the function libevent should use for allocating and freeing - locks. + Sets the functions libevent should use for allocating and freeing + locks. This needs to be called in addition to + evthread_set_locking_callback() before using libevent in a + multi-threaded application. + + @param alloc_fn function to be called when allocating a new lock + @param free_fn function to be called to a free a lock */ -void evthread_set_create_callback(struct event_base *base, +void evthread_set_lock_create_callbacks(struct event_base *base, void *(*alloc_fn)(void), void (*free_fn)(void *)); struct event_base; diff --git a/test/regress_pthread.c b/test/regress_pthread.c index 76fddbf3..51b7ee82 100644 --- a/test/regress_pthread.c +++ b/test/regress_pthread.c @@ -165,11 +165,10 @@ void regress_pthread(void) { struct event_base *base = event_base_new(); - int i; pthread_mutex_init(&count_lock, NULL); - evthread_set_create_callback(base, alloc_lock, free_lock); + evthread_set_lock_create_callbacks(base, alloc_lock, free_lock); evthread_set_locking_callback(base, locking); evthread_set_id_callback(base, get_id);