From 4143760a944470d50975ee27da9e3380223e88b9 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sun, 28 Sep 2014 18:11:39 -0400 Subject: synchronize outside communication --- lib/libalpm/handle.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/libalpm/handle.h') diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 115c3481..9cf396ce 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -26,6 +26,7 @@ #include "alpm_list.h" #include "alpm.h" +#include "thread.h" #ifdef HAVE_LIBCURL #include @@ -34,19 +35,25 @@ #define EVENT(h, e) \ do { \ if((h)->eventcb) { \ + _ALPM_TLOCK_CB(h); \ (h)->eventcb((alpm_event_t *) (e)); \ + _ALPM_TUNLOCK_CB(h); \ } \ } while(0) #define QUESTION(h, q) \ do { \ if((h)->questioncb) { \ + _ALPM_TLOCK_CB(h); \ (h)->questioncb((alpm_question_t *) (q)); \ + _ALPM_TUNLOCK_CB(h); \ } \ } while(0) #define PROGRESS(h, e, p, per, n, r) \ do { \ if((h)->progresscb) { \ + _ALPM_TLOCK_CB(h); \ (h)->progresscb(e, p, per, n, r); \ + _ALPM_TUNLOCK_CB(h); \ } \ } while(0) @@ -114,6 +121,11 @@ struct __alpm_handle_t { /* for delta parsing efficiency */ int delta_regex_compiled; regex_t delta_regex; + +#ifdef HAVE_PTHREAD + pthread_mutex_t tlock_cb; + pthread_mutex_t tlock_log; +#endif }; alpm_handle_t *_alpm_handle_new(void); -- cgit v1.2.3-24-g4f1b