From 976ef26381490f8b9d26c20c13ae9745e87d6270 Mon Sep 17 00:00:00 2001 From: ReBarsotti-HZB Date: Fri, 27 Feb 2026 11:28:00 +0000 Subject: [PATCH] Added Doxygen annotations to dbLock.h --- documentation/Makefile.headers | 1 + modules/database/src/ioc/db/dbLock.h | 55 +++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/documentation/Makefile.headers b/documentation/Makefile.headers index a57f87b81..4ffec75a8 100644 --- a/documentation/Makefile.headers +++ b/documentation/Makefile.headers @@ -74,6 +74,7 @@ database_HEADERS += dbDefs database_HEADERS += dbEvent database_HEADERS += dbExtractArray database_HEADERS += dbLink +database_HEADERS += dbLock database_HEADERS += dbServer database_HEADERS += dbState database_HEADERS += dbStaticLib diff --git a/modules/database/src/ioc/db/dbLock.h b/modules/database/src/ioc/db/dbLock.h index 8fe068ce9..e4428fc2c 100644 --- a/modules/database/src/ioc/db/dbLock.h +++ b/modules/database/src/ioc/db/dbLock.h @@ -24,11 +24,17 @@ extern "C" { struct dbCommon; struct dbBase; -/** @brief Lock multiple records. +/** + * @file dbLock.h + * @brief Lock one or multiple records. * - * A dbLocker allows a caller to simultaneously lock multiple records. - * The list of records is provided to dbLockerAlloc(). - * And the resulting dbLocker can be locked/unlocked repeatedly. + * Locking is required to prevent corruption of record fields due to concurrent + * access by different threads. + */ + /** @brief A dbLocker allows a caller to lock a single record or simultaneously + * lock multiple records. + * The list of records is provided to dbLockerAlloc(). And the resulting + * dbLocker can be locked/unlocked repeatedly. * * Each thread can only lock one dbLocker at a time. * While locked, dbScanLock() may be called only on those records @@ -72,37 +78,68 @@ DBCORE_API void dbLockerFree(dbLocker *plocker); /** @brief Lock all records of dbLocker * - * While locked, caller may access any associated record passed to dbLockerAlloc() . + * Locks multiple record. While locked, caller may access any associated record + * passed to dbLockerAlloc(). * dbScanLockMany() may not be called again (multi-lock is not recursive). * dbScanLock()/dbScanUnlock() may be called on individual record. * The caller must later call dbScanUnlockMany(). * @since 3.16.0.1 */ DBCORE_API void dbScanLockMany(dbLocker*); -/** @brief Unlock all records of dbLocker +/** @brief Unlock all records of dbLocker. + * + * Unlocks the records of dbLocker. A thread must call dbScanUnlockMany with the + * same dbLocker* before calling dbScanLockMany again. * @since 3.16.0.1 */ DBCORE_API void dbScanUnlockMany(dbLocker*); +/** @brief Returns ID number of the lockset*/ DBCORE_API unsigned long dbLockGetLockId( struct dbCommon *precord); +/** @brief During IOC startup the complete list of records is iterated by + * dbLockInitRecords + * + * The required locksets are created and populated based on the links defined + * at the time of IOC startup*/ DBCORE_API void dbLockInitRecords(struct dbBase *pdbbase); + + +/** @brief Frees up locksets which are no longer in use. If lockset is still active, prints warning and calls `dblsr`*/ DBCORE_API void dbLockCleanupRecords(struct dbBase *pdbbase); -/* Lock Set Report */ +/** @brief Lock Set Report + * + * Generates a report showing the lock set to which each record belongs. + * If recordname is 0, "", "*" all records are shown. Otherwise only records + * in the same lock set as recordname are shown. Level can have the following + * values: + * + * 0 - show lock set information only + * + * 1 - show each record in the lock set + * + * 2 - show each record and all database links in the lock set + */ DBCORE_API long dblsr(char *recordname,int level); -/* If recordname NULL then all records*/ /* level = (0,1,2) (lock set state, + recordname, +DB links) */ +/** @brief Displays free and active locksets + */ DBCORE_API long dbLockShowLocked(int level); -/*KLUDGE to support field TPRO*/ + +/** @brief Support for TPRO field */ DBCORE_API int * dbLockSetAddrTrace(struct dbCommon *precord); + /* debugging */ + +/** @brief Returns the reference count */ DBCORE_API unsigned long dbLockGetRefs(struct dbCommon*); +/** @brief Returns the number of active locksets*/ DBCORE_API unsigned long dbLockCountSets(void); #ifdef __cplusplus