blob: a2aed5471c3714951cefb6d61cc55cc34f386182 [file] [log] [blame]
Willy Tarreau374b4422020-06-02 17:46:16 +02001/*
2 * include/haproxy/xref-t.h
3 * Atomic cross-references between two elements - types
4 *
5 * Copyright (C) 2017 Thierry Fournier <thierry.fournier@ozon.io>
6 * Copyright (C) 2020 Willy Tarreau - w@1wt.eu
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28#ifndef __HAPROXY_XREF_T_H__
29#define __HAPROXY_XREF_T_H__
30
31/* xref is used to create relation between two elements.
32 * Once an element is released, it breaks the relation. If the
33 * relation is already broken, it frees the xref struct.
34 * The pointer between two elements is sort of a refcount with
35 * max value 1. The relation is only between two elements.
36 * The pointer and the type of elements a and b are conventional.
37 */
38
39#define XREF_BUSY ((struct xref *)1)
40
41struct xref {
42 struct xref *peer;
43};
44
45#endif /* __HAPROXY_XREF_T_H__ */