Threads Library Functions td_sync_get_info(3THR)
NAME
td_sync_get_info, td_sync_setstate, td_sync_waiters - opera-
tions on a synchronization object in libthread_db
SYNOPSIS
cc [ flag ... ] file ... -lthread_db [ library ... ]
#include <proc_service.h>
#include <thread_db.h>
td_err_e td_sync_get_info(const td_synchandle_t *sh_p,
td_syncinfo_t *si_p);
td_err_e td_sync_setstate(const td_synchandle_t *sh_p);
td_err_etd_sync_waiters(const td_synchandle_t
*sh_p,td_thr_iter_f *cb,void *cb_data_p);
DESCRIPTION
Synchronization objects include mutexes, condition vari-
ables, semaphores, and reader-writer locks. In the same way
that thread operations use a thread handle of type
td_thrhandle_t, operations on synchronization objects use a
synchronization object handle of type td_synchandle_t.
The controlling process obtains synchronization object han-
dles han-
dle by calling
td_ta_map_addr2sync().
Note.
The td_sync_get_info() function fills in the td_syncinfo_t
structure *si_p with values for the synchronization object
identified by sh_p. The td_syncinfo_t structure contains
the following fields:
td_thragent_t *si_ta_p
The internal process handle identifying the tar-
get process through which this synchronization
object handle was obtained. Synchronization
SunOS 5.8 Last change: 19 Oct 1998 1
Threads Library Functions td_sync_get_info(3THR)
objects may be process-private or process-shared.
In the latter case, the same synchronization
object may have multiple handles, one for each
target process's "view" of the synchronization
object.
psaddr_t si_sv_addr
The address of the synchronization object in this
target process's address space.
td_sync_type_e si_type
The type of the synchronization variable: mutex,
condition
variable, semaphore, or reader-writer lock.
int si_shared_type
USYNC_THREAD if this synchronization object is
process-private; USYNC_PROCESS if it is
process-shared.
td_sync_flags_t si_flags
Flags dependent on the type of the synchroniza-
tion object.
int si_state.sema_count
Semaphores only. The current value of the sema-
phore
int si_state.nreaders
Reader-writer locks only. The number of readers
currently holding the lock, or -1, if a writer
is currently holding the lock.
int si_state.mutex_locked
For mutexes only. Non-zero if and only if the
mutex is currently locked.
int si_size
The size of the synchronization object.
uchar_t si_has_waiters
Non-zero if and only if at least one thread is
blocked on this synchronization object.
SunOS 5.8 Last change: 19 Oct 1998 2
Threads Library Functions td_sync_get_info(3THR)
uchar_t si_is_wlocked
For reader-writer locks only. The value is non-
zero if and only if this lock is held by a
writer.
td_thrhandle_t si_owner
Mutexes and reader-writer locks only. This is the
thread holding the mutex, or the write lock, if
this is a reader-writer lock. The value is
NULL if no one holds the mutex or write-lock.
psaddr_t si_data
A pointer to optional data associated with the
synchronization object. Currently useful only
for debugging libthread() interfaces.
td_sync_setstate synchron-
ization.
td_sync_waiters also td_ta_thr_iter(3THR).
RETURN VALUES
TD_OK The call returned successfully.
TD_BADTH
An invalid thread handle was passed in.
TD_DBERR
A call to one of the imported interface routines
failed.
TD_ERR
SunOS 5.8 Last change: 19 Oct 1998 3
Threads Library Functions td_sync_get_info(3THR)
A libthread_db-internal error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| MT Level | Safe |
|_____________________________|_____________________________|
SEE ALSO
libthread_db(3THR), td_ta_map_addr2sync(3THR),
td_ta_sync_iter(3THR), td_ta_thr_iter(3THR),
libthread_db(3LIB), attributes(5)
SunOS 5.8 Last change: 19 Oct 1998 4