Skip to content

Commit 99fbdc6

Browse files
committed
Document diagnostic system
1 parent e79182f commit 99fbdc6

3 files changed

Lines changed: 321 additions & 14 deletions

File tree

include/tscore/Diags.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,26 @@ class DiagsPtr
6161
{
6262
public:
6363
friend Diags *diags();
64-
static void set(Diags *new_ptr);
64+
65+
/// @brief Registers a Diags instance as the global singleton.
66+
///
67+
/// @param new_ptr The Diags instance to register. Must not be nullptr.
68+
/// @pre Called during single-threaded process initialization only.
69+
/// @post diags() returns new_ptr. The instance is also registered with the
70+
/// DebugInterface subsystem.
71+
/// @note Not thread-safe. Must be called exactly once before any logging occurs.
72+
static void set(Diags *new_ptr);
6573

6674
private:
6775
static Diags *_diags_ptr;
6876
};
6977

78+
/// @brief Returns the global Diags singleton.
79+
///
80+
/// @pre DiagsPtr::set() must have been called with a valid Diags instance.
81+
/// @return Pointer to the global Diags instance, or nullptr if not yet initialized.
82+
/// @note Thread-safe for reading; the pointer is set once during single-threaded
83+
/// initialization and never changes thereafter.
7084
inline Diags *
7185
diags()
7286
{

0 commit comments

Comments
 (0)