pthdb_rwlock_addr, pthdb_rwlock_lock_count, pthdb_rwlock_owner, pthdb_rwlock_pshared or pthdb_rwlock_state Subroutine

Purpose

Gets the owner, the pshared value, or the state of the read/write lock.

Library

pthread debug library (libpthdebug.a)

Syntax

#include <sys/pthdebug.h>

int pthdb_rwlock_addr (pthdb_session_t  session,
                       pthdb_rwlock_t   rwlock,
                       pthdb_addr_t * addrp)

int pthdb_rwlock_lock_count (pthdb_session_t  session,
                             pthdb_rwlock_t   rwlock,
                             int * countp);

int pthdb_rwlock_owner (pthdb_session_t  session,
                        pthdb_rwlock_t   rwlock,
                        pthdb_pthread_t * ownerp
                        int              cmd)

int pthdb_rwlock_pshared (pthdb_session_t  session,
                          pthdb_rwlock_t   rwlock,
                          pthdb_pshared_t * psharedp)

int pthdb_rwlock_state (pthdb_session_t       session,
                        pthdb_rwlock_t        rwlock,
                        pthdb_rwlock_state_t * statep)

Description

The pthdb_rwlock_addr function reports the address of the pthdb_rwlock_t.

The pthdb_rwlock_lock_count function reports the lock count for the rwlock.

The pthdb_rwlock_owner function is used to get the read/write lock owner's pthread handle.

The pthdb_rwlock_pshared function is used to get the rwlock attribute process shared value. The pshared value can be PSH_SHARED, PSH_PRIVATE, or PSH_NOTSUP.

The pthdb_rwlock_state is used to get the read/write locks state. The state can be RWLS_NOTSUP, RWLS_WRITE, RWLS_FREE, and RWLS_READ.

Parameters

Item Description
addrp Read write lock address.
countp Read write lock lock count.
cmd cmd can be PTHDB_LIST_FIRST to get the first owner in the list of owners or PTHDB_LIST_NEXT to get the next owner in the list of owners. The list is empty or ended by *owner == PTHDB_INVALID_PTHREAD.
ownerp Pointer to pthread which owns the rwlock
psharedp Pointer to pshared value
rwlock Read write lock handle
session Session handle.
statep Pointer to state value

Return Values

If successful, these functions return PTHDB_SUCCESS. Otherwise, an error code is returned.

Error Codes

Item Description
PTHDB_BAD_SESSION Invalid session handle.
PTHDB_BAD_CMD Invalid command passed.
PTHDB_CALLBACK Debugger call back error.
PTHDB_INTERNAL Error in library.
PTHDB_POINTER Invalid pointer