summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2020-03-10 14:31:15 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2020-03-10 14:31:15 (GMT)
commit99434a37b31ac9a6f5cf9ba5b773da2c4775124b (patch) (side-by-side diff)
tree621fc688cde1a483dd2dfad5d6623fd1ca08b8c3
parentdd82507e6ca3f420eee5d6160515b3b8026731bc (diff)
downloadping903-99434a37b31ac9a6f5cf9ba5b773da2c4775124b.tar.gz
ping903-99434a37b31ac9a6f5cf9ba5b773da2c4775124b.tar.bz2
Remove superfluous saver thread.
* src/ping903.c (ping903): Call p903_update_commit instead of starting a new thread. * src/ping903.h (p903_update_commit): New proto. * src/pinger.c (update_commit): Rename to p903_update_commit; remove static.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/json.h3
-rw-r--r--src/ping903.c4
-rw-r--r--src/ping903.h2
-rw-r--r--src/pinger.c13
4 files changed, 6 insertions, 16 deletions
diff --git a/src/json.h b/src/json.h
index b5fa9d3..f31496c 100644
--- a/src/json.h
+++ b/src/json.h
@@ -57,8 +57,7 @@ struct json_pair {
struct json_value *v;
};
-struct json_format
-{
+struct json_format {
size_t indent;
int precision;
void (*write) (void *, char const *, size_t);
diff --git a/src/ping903.c b/src/ping903.c
index b4ea906..06597bb 100644
--- a/src/ping903.c
+++ b/src/ping903.c
@@ -1312,7 +1312,6 @@ ping903(void)
pthread_t tid;
int fd = -1;
struct sockaddr *server_addr;
- void *p;
struct sigaction act;
p903_init();
@@ -1358,6 +1357,5 @@ ping903(void)
sigwait(&sigs, &i);
info("shutting down on signal %s", strsignal(i));
MHD_stop_daemon(mhd);
- pthread_create(&tid, NULL, p903_saver, NULL);
- pthread_join(tid, &p);
+ p903_update_commit();
}
diff --git a/src/ping903.h b/src/ping903.h
index f0065f3..06cf629 100644
--- a/src/ping903.h
+++ b/src/ping903.h
@@ -176,8 +176,8 @@ int get_host_matches(struct json_value *);
int file_read_ip_list(FILE *fp, char const *fname);
void p903_init(void);
+void p903_update_commit(void);
void *p903_sender(void *p);
void *p903_receiver(void *p);
void *p903_scheduler(void *p);
-void *p903_saver(void *p);
diff --git a/src/pinger.c b/src/pinger.c
index c0276cd..8bb1090 100644
--- a/src/pinger.c
+++ b/src/pinger.c
@@ -865,8 +865,8 @@ hostlist_copy_stat(HOSTLIST *hl)
}
}
-static void
-update_commit(void)
+void
+p903_update_commit(void)
{
HOSTPING *hp;
int upd;
@@ -1478,7 +1478,7 @@ p903_scheduler(void *p)
hostping_reset(hp);
}
/* Commit updates */
- update_commit();
+ p903_update_commit();
send_p = 1;
pthread_cond_broadcast(&sendq_cond);
@@ -1492,10 +1492,3 @@ p903_scheduler(void *p)
}
}
-void *
-p903_saver(void *p)
-{
- update_commit();
- return NULL;
-}
-

Return to:

Send suggestions and report system problems to the System administrator.