]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/base/AsyncCallList.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_BASE_ASYNCCALLLIST_H
10 #define SQUID_BASE_ASYNCCALLLIST_H
12 #include "base/forward.h"
13 #include "base/RefCount.h"
15 /// An efficient (but intrusive) AsyncCall storage preserving FIFO order.
16 /// A given AsyncCall object may reside in at most one such storage.
20 AsyncCallList() = default;
21 // prohibit copying: no AsyncCall should be present in two lists
22 AsyncCallList(const AsyncCallList
&) = delete;
23 AsyncCallList
&operator=(const AsyncCallList
&) = delete;
25 /// stores the given async call
26 void add(const AsyncCallPointer
&);
28 /// removes the earliest add()-ed call that is still stored (if any)
29 /// \returns the removed call (or nil)
30 /// \retval nil means the list stored no calls at extract() time
31 AsyncCallPointer
extract();
33 /// the number of currently stored calls
34 size_t size() const { return length
; }
37 AsyncCallPointer head
; ///< the earliest still-stored call (or nil)
38 AsyncCallPointer tail
; ///< the latest still-stored call (or nil)
39 size_t length
= 0; ///< \copydoc size()
42 #endif /* SQUID_BASE_ASYNCCALLLIST_H */