return rv;
}
-apr_status_t ap_queue_interrupt_all(fd_queue_t * queue)
+static apr_status_t queue_interrupt_all(fd_queue_t *queue, int term)
{
apr_status_t rv;
if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv;
}
+ /* we must hold one_big_mutex when setting this... otherwise,
+ * we could end up setting it and waking everybody up just after a
+ * would-be popper checks it but right before they block
+ */
+ if (term) {
+ queue->terminated = 1;
+ }
apr_thread_cond_broadcast(queue->not_empty);
return apr_thread_mutex_unlock(queue->one_big_mutex);
}
-apr_status_t ap_queue_term(fd_queue_t * queue)
+apr_status_t ap_queue_interrupt_all(fd_queue_t * queue)
{
- apr_status_t rv;
+ return queue_interrupt_all(queue, 0);
+}
- if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
- return rv;
- }
- /* we must hold one_big_mutex when setting this... otherwise,
- * we could end up setting it and waking everybody up just after a
- * would-be popper checks it but right before they block
- */
- queue->terminated = 1;
- if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
- return rv;
- }
- return ap_queue_interrupt_all(queue);
+apr_status_t ap_queue_term(fd_queue_t * queue)
+{
+ return queue_interrupt_all(queue, 1);
}
return rv;
}
-apr_status_t ap_queue_interrupt_all(fd_queue_t *queue)
+static apr_status_t queue_interrupt_all(fd_queue_t *queue, int term)
{
apr_status_t rv;
if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv;
}
+ /* we must hold one_big_mutex when setting this... otherwise,
+ * we could end up setting it and waking everybody up just after a
+ * would-be popper checks it but right before they block
+ */
+ if (term) {
+ queue->terminated = 1;
+ }
apr_thread_cond_broadcast(queue->not_empty);
return apr_thread_mutex_unlock(queue->one_big_mutex);
}
-apr_status_t ap_queue_term(fd_queue_t *queue)
+apr_status_t ap_queue_interrupt_all(fd_queue_t *queue)
{
- apr_status_t rv;
+ return queue_interrupt_all(queue, 0);
+}
- if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
- return rv;
- }
- /* we must hold one_big_mutex when setting this... otherwise,
- * we could end up setting it and waking everybody up just after a
- * would-be popper checks it but right before they block
- */
- queue->terminated = 1;
- if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
- return rv;
- }
- return ap_queue_interrupt_all(queue);
+apr_status_t ap_queue_term(fd_queue_t *queue)
+{
+ return queue_interrupt_all(queue, 1);
}