Enable debugging wrappers around the current lock callbacks. If Libevent makes one of several common locking errors, exit with an assertion failure.
Make sure it's safe to tell an event base to wake up from another thread or a signal handler.
Sets a group of functions that Libevent should use for condition variables. For full information on the required callback API, see the documentation for the individual members of evthread_condition_callbacks.
Sets the function for determining the thread id.
Sets a group of functions that Libevent should use for locking. For full information on the required callback API, see the documentation for the individual members of evthread_lock_callbacks.
Sets up Libevent for use with Pthreads locking and thread ID functions. Unavailable if Libevent is not build for use with pthreads. Requires libraries to link against Libevent_pthreads as well as Libevent.
Sets up Libevent for use with Windows builtin locking and thread ID functions. Unavailable if Libevent is not built for Windows.
A recursive lock is one that can be acquired multiple times at once by the * same thread. No other process can allocate the lock until the thread that * has been holding it has unlocked it as many times as it locked it.
@}
A flag passed to a locking callback when the lock was allocated as a * read-write lock, and we want to acquire or release the lock for reading.
A flag passed to a locking callback when we don't want to block waiting * for the lock; if we can't get the lock immediately, we will instead * return nonzero from the locking callback.
Defined if Libevent was built with support for evthread_use_pthreads()
Defined if Libevent was built with support for evthread_use_windows_threads()
A flag passed to a locking callback when the lock was allocated as a * read-write lock, and we want to acquire or release the lock for writing.
This structure describes the interface a threading library uses for condition variables. It's used to tell evthread_set_condition_callbacks how to use locking on this platform.
This structure describes the interface a threading library uses for locking. It's used to tell evthread_set_lock_callbacks() how to use locking on this platform.
@file event2/thread.h
Functions for multi-threaded applications using Libevent.
When using a multi-threaded application in which multiple threads add and delete events from a single event base, Libevent needs to lock its data structures.
Like the memory-management function hooks, all of the threading functions _must_ be set up before an event_base is created if you want the base to use them.
Most programs will either be using Windows threads or Posix threads. You can configure Libevent to use one of these event_use_windows_threads() or event_use_pthreads() respectively. If you're using another threading library, you'll need to configure threading functions manually using evthread_set_lock_callbacks() and evthread_set_condition_callbacks().