commit 94a6274
default
·
2023-12-26 17:28:43 +0000 UTC
parent ae8f556
Also log the job_fifo len in status.txt.
1 files changed,
+17,
-12
M
httpd.c
M
httpd.c
+17,
-12
1@@ -32,6 +32,18 @@ int srv_running = 0;
2
3 time_t srv_start_time = 0;
4
5+/** job control **/
6+
7+/* mutex to access the lists of jobs */
8+static pthread_mutex_t job_mutex;
9+
10+/* semaphre to trigger job processing */
11+static sem_t *job_sem;
12+
13+/* fifo of jobs */
14+xs_list *job_fifo = NULL;
15+
16+
17 /* nodeinfo 2.0 template */
18 const char *nodeinfo_2_0_template = ""
19 "{\"version\":\"2.0\","
20@@ -219,6 +231,11 @@ int server_get_handler(xs_dict *req, const char *q_path,
21
22 xs *uptime = xs_str_time_diff(time(NULL) - srv_start_time);
23 srv_log(xs_fmt("status: uptime: %s", uptime));
24+
25+ pthread_mutex_lock(&job_mutex);
26+ int l = xs_list_len(job_fifo);
27+ pthread_mutex_unlock(&job_mutex);
28+ srv_log(xs_fmt("status: job_fifo len: %d", l));
29 }
30
31 if (status != 0)
32@@ -417,18 +434,6 @@ void term_handler(int s)
33 }
34
35
36-/** job control **/
37-
38-/* mutex to access the lists of jobs */
39-static pthread_mutex_t job_mutex;
40-
41-/* semaphre to trigger job processing */
42-static sem_t *job_sem;
43-
44-/* fifo of jobs */
45-xs_list *job_fifo = NULL;
46-
47-
48 int job_fifo_ready(void)
49 /* returns true if the job fifo is ready */
50 {