Analysis-Utilities 26.9.9
C++/ROOT utilities for nuclear measurement data analysis
Loading...
Searching...
No Matches
IO::ScopedRootLock Class Reference

RAII guard engaging the same lock used by the open helpers. More...

#include <IOUtils.hpp>

Public Member Functions

 ScopedRootLock ()
 Acquire the shared file-open lock if thread-safe mode is on.
 ~ScopedRootLock ()
 Release the lock if this guard acquired one.

Detailed Description

RAII guard engaging the same lock used by the open helpers.

Use this around code that constructs TFile objects directly instead of going through OpenForReading() / OpenForWriting(), so that hand-rolled opens serialise against the helpers rather than racing them.

The guard is a no-op when thread-safe mode is off, and the underlying mutex is recursive, so nesting a guard inside a helper call is safe.

Note
Non-copyable. The engaged/idle decision is made at construction, so a guard created before SetThreadSafe(kTRUE) stays idle for its lifetime.

Definition at line 113 of file IOUtils.hpp.

Constructor & Destructor Documentation

◆ ScopedRootLock()

IO::ScopedRootLock::ScopedRootLock ( )

Acquire the shared file-open lock if thread-safe mode is on.

Definition at line 48 of file IOUtils.cpp.

◆ ~ScopedRootLock()

IO::ScopedRootLock::~ScopedRootLock ( )

Release the lock if this guard acquired one.

Definition at line 53 of file IOUtils.cpp.


The documentation for this class was generated from the following files: