Esempio n. 1
0
LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation()
{
	if(mQueue != 0) {
		if(apr_queue_size(mQueue) != 0) llwarns << 
			"terminating queue which still contains " << apr_queue_size(mQueue) <<
			" elements;" << "memory will be leaked" << LL_ENDL;
		apr_queue_term(mQueue);
	}
	if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool);
}
Esempio n. 2
0
/*
 * Main writer thread. Takes aside messages from the queue and saves them
 */
static void *writer_main(apr_thread_t *apr_thread, void *data)
{
	ap_log_error(APLOG_MARK, APLOG_INFO, 0, tee_server, "tee: Starting new writer thread (pid/tid %d/%d)",
			getpid(), gettid());
	while (!finishing) {
		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, tee_server, "tee: Blocking on queue (pid %d)", getpid());
		tee_update_status(WAITING);
		tee_saved_request *sr;
		apr_status_t rc = apr_queue_pop(tee_global_queue, (void **) &sr);
		if (rc == APR_EINTR) {
			// This happens when process is ending
			continue;
		}
		tee_update_status(WRITING);
		ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, tee_server, "tee: Request popped (pid %d)", getpid());
		tee_update_queue_len(apr_queue_size(tee_global_queue));
		if (process_request(sr)) {
			ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, sr->server, "tee: File written in %.3f ms (pid %d)",
					(sr->time_written - sr->time_dequeued) / 1000.0, getpid());
		}
		tee_update_saved_file_stats(sr);
		apr_pool_destroy(sr->pool);
	}
	tee_update_status(NULL_STATUS);
	ap_log_error(APLOG_MARK, APLOG_INFO, 0, tee_server, "tee: Finishing writer thread (pid/tid %d/%d)",
				getpid(), gettid());
	return NULL;
}
Esempio n. 3
0
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue)
{
	return apr_queue_size(queue);
}
Esempio n. 4
0
size_t LLThreadSafeQueueImplementation::size()
{
	return apr_queue_size(mQueue);
}