diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-04-20 11:41:18 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-04-20 11:41:18 +0300 |
commit | ce2bded4521255e3a0f7d2926d4198e75743af1d (patch) | |
tree | b97924438f3309a172c0dd09aa1d1ba9e51819c6 /src/wydawca.c | |
parent | 84838fa69592cf37f97aaa918ad4e69b8bd4d62a (diff) | |
download | wydawca-ce2bded4521255e3a0f7d2926d4198e75743af1d.tar.gz wydawca-ce2bded4521255e3a0f7d2926d4198e75743af1d.tar.bz2 |
Rewrite the timer support.
Timers are kept in a thread-specific array variable. Spool timers are
referenced in expansion strings by their fully qualified names, e.g.
${timer:spool:release:system}.
* NEWS: Update.
* doc/wydawca.texi: Document new syntax for the spool timer variables.
* src/directive.c
* src/wydawca.h (struct spool): New member: timer_id.
* tests/upload-dry.at: Filter out certain messages, that can appear
* src/process.c (spool_count): New global.
(register_spool): Build spool list in the same order as listed in the
configuration file.
(spool_timer_id): New function.
* src/timer.c: Rewrite using array of struct timer_slot, instead of the
hash table.
* src/triplet.c (try_timer_var): Rewrite.
* src/wydawca.c (stderr_printer): Protect stderr by a mutex.
in unpredictable order.
Diffstat (limited to 'src/wydawca.c')
-rw-r--r-- | src/wydawca.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wydawca.c b/src/wydawca.c index d07ebdf..58f87ce 100644 --- a/src/wydawca.c +++ b/src/wydawca.c @@ -84,10 +84,13 @@ syslog_printer(int prio, const char *fmt, va_list ap) #endif } +static pthread_mutex_t stderr_mutex = PTHREAD_MUTEX_INITIALIZER; + void stderr_printer(int prio, const char *fmt, va_list ap) { const char *p = wy_pritostr(prio); + pthread_mutex_lock(&stderr_mutex); fprintf(stderr, "%s: ", program_name); if (p) @@ -95,6 +98,7 @@ stderr_printer(int prio, const char *fmt, va_list ap) vfprintf(stderr, fmt, ap); fputc('\n', stderr); + pthread_mutex_unlock(&stderr_mutex); } static void (*log_printer) (int prio, const char *fmt, va_list ap) = |