1 .TH "evthread_condition_callbacks" 3 "Tue Jan 27 2015" "libevent" \" -*- nroff -*-
5 evthread_condition_callbacks \-
7 This structure describes the interface a threading library uses for condition variables\&.
13 \fC#include <thread\&.h>\fP
18 .RI "void *(* \fBalloc_condition\fP )(unsigned condtype)"
20 .RI "\fIFunction to allocate and initialize a new condition variable\&. \fP"
22 .RI "int \fBcondition_api_version\fP"
24 .RI "\fIThe current version of the conditions API\&. \fP"
26 .RI "void(* \fBfree_condition\fP )(void *cond)"
28 .RI "\fIFunction to free a condition variable\&. \fP"
30 .RI "int(* \fBsignal_condition\fP )(void *cond, int broadcast)"
32 .RI "\fIFunction to signal a condition variable\&. \fP"
34 .RI "int(* \fBwait_condition\fP )(void *cond, void *lock, const struct timeval *timeout)"
36 .RI "\fIFunction to wait for a condition variable\&. \fP"
38 .SH "Detailed Description"
40 This structure describes the interface a threading library uses for condition variables\&.
42 It's used to tell evthread_set_condition_callbacks how to use locking on this platform\&.
43 .SH "Field Documentation"
45 .SS "void*(* evthread_condition_callbacks::alloc_condition)(unsigned condtype)"
48 Function to allocate and initialize a new condition variable\&. Returns the condition variable on success, and NULL on failure\&. The 'condtype' argument will be 0 with this API version\&.
49 .SS "int evthread_condition_callbacks::condition_api_version"
52 The current version of the conditions API\&. Set this to EVTHREAD_CONDITION_API_VERSION
53 .SS "void(* evthread_condition_callbacks::free_condition)(void *cond)"
56 Function to free a condition variable\&.
57 .SS "int(* evthread_condition_callbacks::signal_condition)(void *cond, int broadcast)"
60 Function to signal a condition variable\&. If 'broadcast' is 1, all threads waiting on 'cond' should be woken; otherwise, only on one thread is worken\&. Should return 0 on success, -1 on failure\&. This function will only be called while holding the associated lock for the condition\&.
61 .SS "int(* evthread_condition_callbacks::wait_condition)(void *cond, void *lock, const struct timeval *timeout)"
64 Function to wait for a condition variable\&. The lock 'lock' will be held when this function is called; should be released while waiting for the condition to be come signalled, and should be held again when this function returns\&. If timeout is provided, it is interval of seconds to wait for the event to become signalled; if it is NULL, the function should wait indefinitely\&.
66 The function should return -1 on error; 0 if the condition was signalled, or 1 on a timeout\&.
70 Generated automatically by Doxygen for libevent from the source code\&.