/*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
/// All locks must be cleared before it may be destroyed.
void lock() const {
#if defined(LOCKCOUNT_DEBUG)
- old_debug(0,1)("Incrementing this %p from count %u\n",this,count_);
+ debugs(0,1, "Incrementing this " << static_cast<void*>(this) << " from count " << count_);
#endif
+ assert(count_ < UINT32_MAX);
++count_;
}
/// Clear one lock / reference against this object.
/// All locks must be cleared before it may be destroyed.
- unsigned unlock() const {
+ uint32_t unlock() const {
#if defined(LOCKCOUNT_DEBUG)
- old_debug(0,1)("Decrementing this %p from count %u\n",this,count_);
+ debugs(0,1, "Decrementing this " << static_cast<void*>(this) << " from count " << count_);
#endif
assert(count_ > 0);
return --count_;
}
/// Inspect the current count of references.
- unsigned LockCount() const { return count_; }
+ uint32_t LockCount() const { return count_; }
private:
- mutable unsigned count_; ///< number of references currently being tracked
+ mutable uint32_t count_; ///< number of references currently being tracked
};
// For clarity we provide some aliases for the tracking mechanisms
#define RefCountable virtual Lock
#endif /* SQUID_SRC_BASE_LOCK_H */
+