libevent
2.2.1
Event notification library
|
Go to the documentation of this file.
26 #ifndef EVENT2_THREAD_H_INCLUDED_
27 #define EVENT2_THREAD_H_INCLUDED_
49 #include <event2/visibility.h>
55 #include <event2/event-config.h>
64 #define EVTHREAD_WRITE 0x04
67 #define EVTHREAD_READ 0x08
71 #define EVTHREAD_TRY 0x10
74 #if !defined(EVENT__DISABLE_THREAD_SUPPORT) || defined(EVENT_IN_DOXYGEN_)
76 #define EVTHREAD_LOCK_API_VERSION 1
85 #define EVTHREAD_LOCKTYPE_RECURSIVE 1
88 #define EVTHREAD_LOCKTYPE_READWRITE 2
109 void *(*alloc)(
unsigned locktype);
132 #define EVTHREAD_CONDITION_API_VERSION 1
148 void *(*alloc_condition)(
unsigned condtype);
169 const struct timeval *timeout);
192 unsigned long (*id_fn)(
void));
194 #if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined(EVENT_IN_DOXYGEN_)
204 #define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 1
207 #if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_)
218 #define EVTHREAD_PTHREAD_PRIO_INHERIT 0x01
232 #define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
248 void evthread_enable_lock_debuging(
void);
EVENT2_EXPORT_SYMBOL int evthread_set_lock_callbacks(const struct evthread_lock_callbacks *)
Sets a group of functions that Libevent should use for locking.
EVENT2_EXPORT_SYMBOL void evthread_enable_lock_debugging(void)
Enable debugging wrappers around the current lock callbacks.
This structure describes the interface a threading library uses for condition variables.
Definition: thread.h:140
EVENT2_EXPORT_SYMBOL void evthread_set_id_callback(unsigned long(*id_fn)(void))
Sets the function for determining the thread id.
int lock_api_version
The current version of the locking API.
Definition: thread.h:98
int(* lock)(unsigned mode, void *lock)
Acquire an already-allocated lock at 'lock' with mode 'mode'.
Definition: thread.h:115
Structure to hold information and state for a Libevent dispatch loop.
Definition: event.h:219
int(* signal_condition)(void *cond, int broadcast)
Function to signal a condition variable.
Definition: thread.h:157
unsigned supported_locktypes
Which kinds of locks does this version of the locking API support? A bitfield of EVTHREAD_LOCKTYPE_RE...
Definition: thread.h:106
EVENT2_EXPORT_SYMBOL int evthread_set_condition_callbacks(const struct evthread_condition_callbacks *)
Sets a group of functions that Libevent should use for condition variables.
int(* wait_condition)(void *cond, void *lock, const struct timeval *timeout)
Function to wait for a condition variable.
Definition: thread.h:168
int(* unlock)(unsigned mode, void *lock)
Release a lock at 'lock' using mode 'mode'.
Definition: thread.h:118
EVENT2_EXPORT_SYMBOL int evthread_use_pthreads_with_flags(int flags)
Sets up Libevent for use with Pthreads locking and thread ID functions.
This structure describes the interface a threading library uses for locking.
Definition: thread.h:95
void(* free_condition)(void *cond)
Function to free a condition variable.
Definition: thread.h:150
int condition_api_version
The current version of the conditions API.
Definition: thread.h:143
EVENT2_EXPORT_SYMBOL int evthread_use_pthreads(void)
Sets up Libevent for use with Pthreads locking and thread ID functions.
void(* free)(void *lock, unsigned locktype)
Function to release all storage held in 'lock', which was created with type 'locktype'.
Definition: thread.h:112
EVENT2_EXPORT_SYMBOL int evthread_make_base_notifiable(struct event_base *base)
Make sure it's safe to tell an event base to wake up from another thread or a signal handler.
EVENT2_EXPORT_SYMBOL int evthread_use_windows_threads(void)
Sets up Libevent for use with Windows builtin locking and thread ID functions.