mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 13:04:23 -04:00
rename lock create callback functions; as suggested by nick
svn:r691
This commit is contained in:
parent
c182baca10
commit
cb50f615d4
2
event.c
2
event.c
@ -1213,7 +1213,7 @@ evthread_set_id_callback(struct event_base *base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
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 *))
|
void *(*alloc_fn)(void), void (*free_fn)(void *))
|
||||||
{
|
{
|
||||||
#ifdef DISABLE_THREAD_SUPPORT
|
#ifdef DISABLE_THREAD_SUPPORT
|
||||||
|
@ -63,10 +63,15 @@ extern "C" {
|
|||||||
#define EVTHREAD_READ 0x08
|
#define EVTHREAD_READ 0x08
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the function libevent should use for allocating and freeing
|
Sets the functions libevent should use for allocating and freeing
|
||||||
locks.
|
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 *));
|
void *(*alloc_fn)(void), void (*free_fn)(void *));
|
||||||
|
|
||||||
struct event_base;
|
struct event_base;
|
||||||
|
@ -165,11 +165,10 @@ void
|
|||||||
regress_pthread(void)
|
regress_pthread(void)
|
||||||
{
|
{
|
||||||
struct event_base *base = event_base_new();
|
struct event_base *base = event_base_new();
|
||||||
int i;
|
|
||||||
|
|
||||||
pthread_mutex_init(&count_lock, NULL);
|
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_locking_callback(base, locking);
|
||||||
evthread_set_id_callback(base, get_id);
|
evthread_set_id_callback(base, get_id);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user