]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/security/LockingPointer.h
1 #ifndef SQUID_SRC_SECURITY_LOCKINGPOINTER_H
2 #define SQUID_SRC_SECURITY_LOCKINGPOINTER_H
4 #include "base/TidyPointer.h"
10 * Add SSL locking (a.k.a. reference counting) to TidyPointer
12 template <typename T
, void (*DeAllocator
)(T
*t
), int lock
>
13 class LockingPointer
: public TidyPointer
<T
, DeAllocator
>
16 typedef TidyPointer
<T
, DeAllocator
> Parent
;
18 LockingPointer(T
*t
= nullptr): Parent(t
) {}
20 void resetAndLock(T
*t
) {
21 if (t
!= this->get()) {
25 CRYPTO_add(&t
->references
, 1, lock
);
27 // XXX: GnuTLS does not provide locking ?
35 } // namespace Security
37 #endif /* SQUID_SRC_SECURITY_LOCKINGPOINTER_H */