MINOR: queue: add queue_init() to initialize a queue

This is better and cleaner than open-coding this in the server and
proxy code, where it has all chances of becoming wrong once forgotten.
This commit is contained in:
Willy Tarreau
2021-06-23 15:08:06 +02:00
parent ae0b12ee03
commit df3b0cbe31
3 changed files with 9 additions and 4 deletions

View File

@@ -109,6 +109,13 @@ static inline int queue_limit_offset(int offset)
return offset;
}
static inline void queue_init(struct queue *queue)
{
queue->head = EB_ROOT;
queue->length = 0;
queue->idx = 0;
HA_SPIN_INIT(&queue->lock);
}
#endif /* _HAPROXY_QUEUE_H */