mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Better behaviour on broken queue items.
This commit is contained in:
parent
3d1f6049e2
commit
aa1524be71
16
httpd.c
16
httpd.c
@ -451,15 +451,18 @@ void job_post(const xs_val *job, int urgent)
|
||||
job_fifo = xs_list_append(job_fifo, job);
|
||||
|
||||
p_stat->job_fifo_size++;
|
||||
|
||||
srv_debug(2, xs_fmt(
|
||||
"job_fifo sizes: %d %08x", p_stat->job_fifo_size, xs_size(job_fifo)));
|
||||
}
|
||||
|
||||
/* unlock the mutex */
|
||||
pthread_mutex_unlock(&job_mutex);
|
||||
}
|
||||
|
||||
/* ask for someone to attend it */
|
||||
sem_post(job_sem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void job_wait(xs_val **job)
|
||||
@ -502,9 +505,12 @@ static void *job_thread(void *arg)
|
||||
|
||||
srv_debug(2, xs_fmt("job thread %d wake up", pid));
|
||||
|
||||
if (job == NULL)
|
||||
break;
|
||||
if (job == NULL) /* corrupted message? */
|
||||
continue;
|
||||
|
||||
if (xs_type(job) == XSTYPE_FALSE) /* special message: exit */
|
||||
break;
|
||||
else
|
||||
if (xs_type(job) == XSTYPE_DATA) {
|
||||
/* it's a socket */
|
||||
FILE *f = NULL;
|
||||
@ -703,9 +709,9 @@ void httpd(void)
|
||||
|
||||
p_stat->srv_running = 0;
|
||||
|
||||
/* send as many empty jobs as working threads */
|
||||
/* send as many exit jobs as working threads */
|
||||
for (n = 1; n < p_stat->n_threads; n++)
|
||||
job_post(NULL, 0);
|
||||
job_post(xs_stock_false, 0);
|
||||
|
||||
/* wait for all the threads to exit */
|
||||
for (n = 0; n < p_stat->n_threads; n++)
|
||||
|
@ -1 +1 @@
|
||||
/* 3e906b28aaa910cd79dd5eb1d88fda82201d28de 2024-01-04T09:20:12+01:00 */
|
||||
/* 72caf9fc60c0b90f39a3c62b238d1c9663d109bc 2024-01-07T09:26:08+01:00 */
|
||||
|
Loading…
Reference in New Issue
Block a user