summaryrefslogtreecommitdiff
path: root/sntp/libevent/evthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'sntp/libevent/evthread.c')
-rw-r--r--sntp/libevent/evthread.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sntp/libevent/evthread.c b/sntp/libevent/evthread.c
index 4da5d24..02dab7a 100644
--- a/sntp/libevent/evthread.c
+++ b/sntp/libevent/evthread.c
@@ -69,12 +69,25 @@ evthread_set_id_callback(unsigned long (*id_fn)(void))
evthread_id_fn_ = id_fn;
}
+struct evthread_lock_callbacks *evthread_get_lock_callbacks()
+{
+ return evthread_lock_debugging_enabled_
+ ? &original_lock_fns_ : &evthread_lock_fns_;
+}
+struct evthread_condition_callbacks *evthread_get_condition_callbacks()
+{
+ return evthread_lock_debugging_enabled_
+ ? &original_cond_fns_ : &evthread_cond_fns_;
+}
+void evthreadimpl_disable_lock_debugging_(void)
+{
+ evthread_lock_debugging_enabled_ = 0;
+}
+
int
evthread_set_lock_callbacks(const struct evthread_lock_callbacks *cbs)
{
- struct evthread_lock_callbacks *target =
- evthread_lock_debugging_enabled_
- ? &original_lock_fns_ : &evthread_lock_fns_;
+ struct evthread_lock_callbacks *target = evthread_get_lock_callbacks();
if (!cbs) {
if (target->alloc)
@@ -109,9 +122,7 @@ evthread_set_lock_callbacks(const struct evthread_lock_callbacks *cbs)
int
evthread_set_condition_callbacks(const struct evthread_condition_callbacks *cbs)
{
- struct evthread_condition_callbacks *target =
- evthread_lock_debugging_enabled_
- ? &original_cond_fns_ : &evthread_cond_fns_;
+ struct evthread_condition_callbacks *target = evthread_get_condition_callbacks();
if (!cbs) {
if (target->alloc_condition)