pthdb_attr, pthdb_cond, pthdb_condattr, pthdb_key, pthdb_mutex, pthdb_mutexattr, pthdb_pthread, pthdb_pthread_key, pthdb_rwlock, or pthdb_rwlockattr Subroutine

Purpose

Reports the pthread library objects.

Library

pthread debug library (libpthdebug.a)

Syntax

#include <sys/pthdebug.h>

int pthdb_pthread (pthdb_session_t  session,
                   pthdb_pthread_t * pthreadp,
                   int              cmd)
int pthdb_pthread_key(pthdb_session_t  session,
                      pthread_key_t   * keyp,
                      int              cmd)
int pthdb_attr(pthdb_session_t  session,
               pthdb_attr_t    * attrp,
               int              cmd)
int pthdb_cond (pthdb_session_t  session,
                pthdb_cond_t    * condp,
                int              cmd)
int pthdb_condattr (pthdb_session_t   session,
                    pthdb_condattr_t * condattrp,
                    int               cmd)
int pthdb_key(pthdb_session_t  session,
              pthdb_pthread_t  pthread,
              pthread_key_t   * keyp,
              int              cmd)
int pthdb_mutex (pthdb_session_t  session,
                 pthdb_mutex_t   * mutexp,
                 int              cmd)
int pthdb_mutexattr (pthdb_session_t    session,
                     pthdb_mutexattr_t * mutexattrp,
                     int                cmd)
int pthdb_rwlock (pthdb_session_t  session,
                  pthdb_rwlock_t  * rwlockp,
                  int              cmd)
int pthdb_rwlockattr (pthdb_session_t     session,
                      pthdb_rwlockattr_t * rwlockattrp,
                      int                 cmd)

Description

The pthread library maintains internal lists of objects: pthreads, mutexes, mutex attributes, condition variables, condition variable attributes, read/write locks, read/write lock attributes, attributes, pthread specific keys, and active keys. The pthread debug library provides access to these lists one element at a time via the functions listed above.

Each one of those functions acquire the next element in the list of objects. For example, the pthdb_attr function gets the next attribute on the list of attributes.

A report of PTHDB_INVALID_OBJECT represents the empty list or the end of a list, where OBJECT is equal to PTHREAD, ATTR, MUTEX, MUTEXATTR, COND, CONDATTR, RWLOCK, RWLOCKATTR, KEY, or TID as appropriate.

Each list is reset to the top of the list when the pthdb_session_update function is called, or when the list function reports a PTHDB_INVALID_* value. For example, when pthdb_attr reports an attribute of PTHDB_INVALID_ATTR the list is reset to the beginning such that the next call reports the first attribute in the list, if any.

When PTHDB_LIST_FIRST is passed for the cmd parameter, the first item in the list is retrieved.

Parameters

Item Description
session Session handle.
attrp Attribute object.
cmd Reset to the beginning of the list.
condp Pointer to Condition variable object.
condattrp Pointer to Condition variable attribute object.
keyp Pointer to Key object.
mutexattrp Pointer to Mutex attribute object.
mutexp Pointer to Mutex object.
pthread pthread object.
pthreadp Pointer to pthread object.
rwlockp Pointer to Read/Write lock object.
rwlockattrp Pointer to Read/Write lock attribute object.

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_PTHREAD Invalid pthread handle.
PTHDB_BAD_CMD Invalid command.
PTHDB_BAD_POINTER Invalid buffer pointer.
PTHDB_INTERNAL Error in library.
PTHDB_MEMORY Not enough memory