diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-09-29 00:11:39 +0200 |
---|---|---|
committer | Andrew Gregory <andrew.gregory.8@gmail.com> | 2017-05-11 06:45:30 +0200 |
commit | 4143760a944470d50975ee27da9e3380223e88b9 (patch) | |
tree | 1e975dd3aeb59ec888292d813c9a147d122153f4 /lib/libalpm/log.c | |
parent | 5c2208294dc0b21a7aa40b9eb56f64f237c48efb (diff) | |
download | pacman-4143760a944470d50975ee27da9e3380223e88b9.tar.gz pacman-4143760a944470d50975ee27da9e3380223e88b9.tar.xz |
synchronize outside communication
Diffstat (limited to 'lib/libalpm/log.c')
-rw-r--r-- | lib/libalpm/log.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index f7dd5336..82c0edad 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -22,12 +22,14 @@ #include <stdarg.h> #include <errno.h> #include <syslog.h> +#include <pthread.h> /* libalpm */ #include "log.h" #include "handle.h" #include "util.h" #include "alpm.h" +#include "thread.h" /** \addtogroup alpm_log Logging Functions * @brief Functions to log using libalpm @@ -62,6 +64,7 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *prefix, if(!(prefix && *prefix)) { prefix = "UNKNOWN"; } + _ALPM_TLOCK_LOG(handle); /* check if the logstream is open already, opening it if needed */ if(handle->logstream == NULL && handle->logfile != NULL) { @@ -83,6 +86,8 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *prefix, } } + _ALPM_TUNLOCK_LOG(handle); + va_start(args, fmt); if(handle->usesyslog) { @@ -118,7 +123,9 @@ void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag, const char *fmt, ... } va_start(args, fmt); + _ALPM_TLOCK_CB(handle); handle->logcb(flag, fmt, args); + _ALPM_TUNLOCK_CB(handle); va_end(args); } @@ -138,6 +145,8 @@ int _alpm_logaction(alpm_handle_t *handle, const char *prefix, prefix = "UNKNOWN"; } + _ALPM_TLOCK_LOG(handle); + if(handle->usesyslog) { /* we can't use a va_list more than once, so we need to copy it * so we can use the original when calling vfprintf below. */ @@ -162,6 +171,8 @@ int _alpm_logaction(alpm_handle_t *handle, const char *prefix, fflush(handle->logstream); } + _ALPM_TUNLOCK_LOG(handle); + return ret; } |