JosiahWI commented on code in PR #13262:
URL: https://github.com/apache/trafficserver/pull/13262#discussion_r3403611149
##########
include/tscore/Diags.h:
##########
@@ -61,12 +61,26 @@ class DiagsPtr
{
public:
friend Diags *diags();
- static void set(Diags *new_ptr);
+
+ /// @brief Registers a Diags instance as the global singleton.
+ ///
+ /// @param new_ptr The Diags instance to register. Must not be nullptr.
+ /// @pre Called during single-threaded process initialization only.
+ /// @post diags() returns new_ptr. The instance is also registered with the
+ /// DebugInterface subsystem.
+ /// @note Not thread-safe. Must be called exactly once before any logging
occurs.
+ static void set(Diags *new_ptr);
private:
static Diags *_diags_ptr;
};
+/// @brief Returns the global Diags singleton.
+///
+/// @pre DiagsPtr::set() must have been called with a valid Diags instance.
+/// @return Pointer to the global Diags instance, or nullptr if not yet
initialized.
Review Comment:
Correct. 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]