RTI Connext TSS C++ API  Version 4.2.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
FACE::TSS::TssMutexGuard Class Reference

RAII guard for TSS_Mutex (POSIX pthread_mutex_t wrapper) More...

#include <TssMutexGuard.hpp>

Public Member Functions

 TssMutexGuard (TSS_Mutex *mutex, bool initialized)
 Attempt to acquire lock on construction.
 ~TssMutexGuard ()
 Release lock on destruction (if acquired)
bool locked () const
 Check whether lock was successfully acquired.
void unlock ()
 Manually release the lock before destruction.
bool relock ()
 Re-acquire the lock after a prior unlock().

Detailed Description

RAII guard for TSS_Mutex (POSIX pthread_mutex_t wrapper)

Acquires lock on construction, releases on destruction. Guards against use-after-lock and missing unlock via RAII discipline. Safe for exception-based unwinding in C++.


Constructor & Destructor Documentation

FACE::TSS::TssMutexGuard::TssMutexGuard ( TSS_Mutex *  mutex,
bool  initialized 
)
inline

Attempt to acquire lock on construction.

Parameters:
mutexPointer to TSS_Mutex (may be NULL)
initializedWhether the mutex has been initialized
FACE::TSS::TssMutexGuard::~TssMutexGuard ( )
inline

Release lock on destruction (if acquired)


Member Function Documentation

bool FACE::TSS::TssMutexGuard::locked ( ) const
inline

Check whether lock was successfully acquired.

Returns:
true if lock is held, false otherwise
void FACE::TSS::TssMutexGuard::unlock ( )
inline

Manually release the lock before destruction.

Safe to call multiple times; subsequent calls are no-ops.

bool FACE::TSS::TssMutexGuard::relock ( )
inline

Re-acquire the lock after a prior unlock().

Returns:
true if the lock was successfully re-acquired.

RTI Connext TSS C++ API Version 4.2.0 Copyright © Fri Aug 7 2026 Real-Time Innovations, Inc