Rename time_lock to avoid name conflict on AIX

This commit is contained in:
pooler 2012-04-16 00:37:09 +02:00
parent 858601d91f
commit ff69f18995
3 changed files with 7 additions and 7 deletions

View file

@ -120,7 +120,7 @@ struct thr_info *thr_info;
static int work_thr_id; static int work_thr_id;
int longpoll_thr_id; int longpoll_thr_id;
struct work_restart *work_restart = NULL; struct work_restart *work_restart = NULL;
pthread_mutex_t time_lock; pthread_mutex_t applog_lock;
pthread_mutex_t stats_lock; pthread_mutex_t stats_lock;
static unsigned long accepted_count = 0L; static unsigned long accepted_count = 0L;
@ -934,7 +934,7 @@ int main(int argc, char *argv[])
/* parse command line */ /* parse command line */
parse_cmdline(argc, argv); parse_cmdline(argc, argv);
pthread_mutex_init(&time_lock, NULL); pthread_mutex_init(&applog_lock, NULL);
pthread_mutex_init(&stats_lock, NULL); pthread_mutex_init(&stats_lock, NULL);
pthread_mutex_init(&g_work_lock, NULL); pthread_mutex_init(&g_work_lock, NULL);

View file

@ -158,7 +158,7 @@ extern bool have_longpoll;
extern char *opt_proxy; extern char *opt_proxy;
extern long opt_proxy_type; extern long opt_proxy_type;
extern bool use_syslog; extern bool use_syslog;
extern pthread_mutex_t time_lock; extern pthread_mutex_t applog_lock;
extern struct thr_info *thr_info; extern struct thr_info *thr_info;
extern int longpoll_thr_id; extern int longpoll_thr_id;
extern struct work_restart *work_restart; extern struct work_restart *work_restart;

8
util.c
View file

@ -91,10 +91,10 @@ void applog(int prio, const char *fmt, ...)
time(&now); time(&now);
pthread_mutex_lock(&time_lock); pthread_mutex_lock(&applog_lock);
tm_p = localtime(&now); tm_p = localtime(&now);
memcpy(&tm, tm_p, sizeof(tm)); memcpy(&tm, tm_p, sizeof(tm));
pthread_mutex_unlock(&time_lock); pthread_mutex_unlock(&applog_lock);
len = 40 + strlen(fmt) + 2; len = 40 + strlen(fmt) + 2;
f = alloca(len); f = alloca(len);
@ -106,9 +106,9 @@ void applog(int prio, const char *fmt, ...)
tm.tm_min, tm.tm_min,
tm.tm_sec, tm.tm_sec,
fmt); fmt);
pthread_mutex_lock(&time_lock); pthread_mutex_lock(&applog_lock);
vfprintf(stderr, f, ap); /* atomic write to stderr */ vfprintf(stderr, f, ap); /* atomic write to stderr */
pthread_mutex_unlock(&time_lock); pthread_mutex_unlock(&applog_lock);
} }
va_end(ap); va_end(ap);
} }