[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

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

Purpose

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.

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 PTHDB_LIST_FIRST is passed for the cmd parameter, or after PTHDB_END is returned. The cmd parameter can be either PTHDB_LIST_NEXT or PTHDB_LIST_FIRST.

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

Parameters

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

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

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The pthdebug.h file.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]