File: request_queue.h

package info (click to toggle)
libapache2-mod-tile 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,872 kB
  • sloc: cpp: 18,151; ansic: 7,574; sh: 980; makefile: 163; xml: 27
file content (77 lines) | stat: -rw-r--r-- 2,257 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 * Copyright (c) 2007 - 2023 by mod_tile contributors (see AUTHORS file)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; If not, see http://www.gnu.org/licenses/.
 */

#ifndef REQUEST_QUEUE_H
#define REQUEST_QUEUE_H

#include "gen_tile.h"
#include "render_config.h"
#include <pthread.h>

#ifdef __cplusplus
extern "C" {
#endif

#define HASHIDX_SIZE 2213

typedef struct {
	long noDirtyRender;
	long noReqRender;
	long noReqPrioRender;
	long noReqLowRender;
	long noReqBulkRender;
	long noReqDroped;
	long noZoomRender[MAX_ZOOM + 1];
	long timeReqRender;
	long timeReqPrioRender;
	long timeReqLowRender;
	long timeReqBulkRender;
	long timeReqDirty;
	long timeZoomRender[MAX_ZOOM + 1];
} stats_struct;

struct item_idx {
	struct item_idx *next;
	struct item *item;
};

struct request_queue {
	int hashidxSize;
	struct item reqHead, reqPrioHead, reqLowHead, reqBulkHead, dirtyHead, renderHead;
	struct item_idx *item_hashidx;
	int reqNum, reqPrioNum, reqLowNum, reqBulkNum, dirtyNum;
	pthread_mutex_t qLock;
	pthread_cond_t qCond;
	stats_struct stats;
};

struct request_queue *request_queue_init();
void request_queue_close(struct request_queue *queue);

struct item *request_queue_fetch_request(struct request_queue *queue);
enum protoCmd request_queue_add_request(struct request_queue *queue, struct item *request);

void request_queue_remove_request(struct request_queue *queue, struct item *request, int render_time);
void request_queue_clear_requests_by_fd(struct request_queue *queue, int fd);

int request_queue_no_requests_queued(struct request_queue *queue, enum protoCmd);
void request_queue_copy_stats(struct request_queue *queue, stats_struct *stats);

#ifdef __cplusplus
}
#endif
#endif