26 #ifndef _EVENT2_THREAD_H_
27 #define _EVENT2_THREAD_H_
53 #include <event2/event-config.h>
56 #include "opal_rename.h"
66 #define EVTHREAD_WRITE 0x04
69 #define EVTHREAD_READ 0x08
73 #define EVTHREAD_TRY 0x10
76 #if !defined(_EVENT_DISABLE_THREAD_SUPPORT) || defined(_EVENT_IN_DOXYGEN)
78 #define EVTHREAD_LOCK_API_VERSION 1
87 #define EVTHREAD_LOCKTYPE_RECURSIVE 1
90 #define EVTHREAD_LOCKTYPE_READWRITE 2
111 void *(*alloc)(
unsigned locktype);
117 int (*lock)(
unsigned mode,
void *
lock);
133 #define EVTHREAD_CONDITION_API_VERSION 1
149 void *(*alloc_condition)(
unsigned condtype);
170 const struct timeval *timeout);
192 unsigned long (*id_fn)(
void));
194 #if (defined(WIN32) && !defined(_EVENT_DISABLE_THREAD_SUPPORT)) || defined(_EVENT_IN_DOXYGEN)
199 int evthread_use_windows_threads(
void);
203 #define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 1
206 #if defined(_EVENT_HAVE_PTHREADS) || defined(_EVENT_IN_DOXYGEN)
212 int evthread_use_pthreads(
void);
214 #define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
int evthread_set_lock_callbacks(const struct evthread_lock_callbacks *)
Sets a group of functions that Libevent should use for locking.
Definition: evthread.c:72
This structure describes the interface a threading library uses for condition variables.
Definition: thread.h:141
int evthread_set_condition_callbacks(const struct evthread_condition_callbacks *)
Sets a group of functions that Libevent should use for condition variables.
Definition: evthread.c:104
int(* unlock)(unsigned mode, void *lock)
Release a lock at 'lock' using mode 'mode'.
Definition: thread.h:120
void evthread_set_id_callback(unsigned long(*id_fn)(void))
Sets the function for determining the thread id.
Definition: evthread.c:66
void(* free_condition)(void *cond)
Function to free a condition variable.
Definition: thread.h:151
int lock_api_version
The current version of the locking API.
Definition: thread.h:100
int condition_api_version
The current version of the conditions API.
Definition: thread.h:144
void(* free)(void *lock, unsigned locktype)
Funtion to release all storage held in 'lock', which was created with type 'locktype'.
Definition: thread.h:114
int(* lock)(unsigned mode, void *lock)
Acquire an already-allocated lock at 'lock' with mode 'mode'.
Definition: thread.h:117
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...
Definition: event.c:2730
This structure describes the interface a threading library uses for locking.
Definition: thread.h:97
void evthread_enable_lock_debuging(void)
Enable debugging wrappers around the current lock callbacks.
Definition: evthread.c:258
int(* wait_condition)(void *cond, void *lock, const struct timeval *timeout)
Function to wait for a condition variable.
Definition: thread.h:169
unsigned supported_locktypes
Which kinds of locks does this version of the locking API support? A bitfield of EVTHREAD_LOCKTYPE_RE...
Definition: thread.h:108
int(* signal_condition)(void *cond, int broadcast)
Function to signal a condition variable.
Definition: thread.h:158
Definition: event-internal.h:167