| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- thread events in libc_db
cc [flag... ]file... -lc_db [library... ]#include <proc_service.h>#include <thread_db.h>td_err_etd_ta_event_addr(const td_thragent_t *ta_p,u_long event,td_notify_t *notify_p);
td_err_etd_thr_event_enable(const td_thrhandle_t *th_p,inton_off);
td_err_etd_thr_set_event(const td_thrhandle_t *th_p,td_thr_events_t *events);
td_err_etd_ta_set_event(const td_thragent_t *ta_p,td_thr_events_t *events);
td_err_etd_thr_clear_event(const td_thrhandle_t *th_p,td_thr_events_t *events);
td_err_etd_ta_clear_event(const td_thragent_t *ta_p,td_thr_events_t *events);
td_err_etd_thr_event_getmsg(const td_thrhandle_t *th_p,td_event_msg_t *msg);
td_err_etd_ta_event_getmsg(const td_thragent_t *ta_p,td_event_msg_t *msg);
voidtd_event_emptyset(td_thr_events_t *);
voidtd_event_fillset(td_thr_events_t *);
voidtd_event_addset(td_thr_events_t*,td_thr_events_e n);
voidtd_event_delset(td_thr_events_t*,td_thr_events_e n);
voidtd_eventismember(td_thr_events_t*,td_thr_events_e n);
voidtd_eventisempty(td_thr_events_t*);
These functions comprise the thread event facility forlibc_db(3LIB). This facility allowsthe controlling process to be notified when certain thread-related events occur in atarget process and to retrieve information associated with these events. Anevent consists of an event type, and optionally, some associated eventdata, depending on the event type. See the section titled "EventSet Manipulation Macros" that follows.
The event type and the associated event data, if any, constitutean "event message." "Reporting an event" means delivering anevent message to the controlling process by way oflibc_db.
Several flags can control event reporting, both a per-thread and per eventbasis. Event reporting may further be enabled or disabled for athread. There is not only a per-thread event mask that specifies which event types should be reported for that thread, but there isalso a global event mask that applies to all threads.
An event is reported, if and only if, the executing thread hasevent reporting enabled, and either the event type is enabled in theexecuting thread's event mask, or the event type is enabled in theglobal event mask.
Each thread has associated with it an event buffer in which itstores the most recent event message it has generated, the type ofthe most recent event that it reported, and, depending on the eventtype, some additional information related to that event. See the sectiontitled "Event Set Manipulation Macros" for a description of thetd_thr_events_eandtd_event_msg_t types and a list of the event types and thevalues reported with them. The thread handle, typetd_thrhandle_t, the event type,and the possible value, together constitute an event message. Each thread's event bufferholds at most one event message.
Each event type has an event reporting address associated with it. A thread reports an event by writing the event message into thethread's event buffer and having control reach the event reporting address forthat event type.
Typically, the controlling process sets a breakpoint at the event reporting addressfor one or more event types. When the breakpoint is hit, thecontrolling process knows that an event of the corresponding type has occurred.
The event types, and the additional information, if any, reported with eachevent, are:
The thread became ready to execute.
The thread has blocked on a synchronization object.
A runnable thread is being assigned to LWP.
A running thread is being removed from its LWP.
A thread is trying to get an unavailable lock.
A signal was posted to a thread.
An LWP is becoming idle.
A thread is being created.
A thread has terminated.
A thread is being preempted.
A thread is inheriting an elevated priority from another thread.
A thread is being reaped.
The number of LWPs is changing.
A condition-variable timed wait expired.
Thetd_ta_event_addr() function returns in *notify_p the event reporting address associated withevent typeevent. The controlling process may then set a breakpoint atthat address. If a thread hits that breakpoint, it reports an eventof typeevent.
Thetd_thr_event_enable() function enables or disables event reporting for threadth_p. Ifa thread has event reporting disabled, it will not report any events.Threads are started with event reporting disabled. Event reporting is enabledifon_off is non-zero; otherwise, it is disabled. To determine whetheror not event reporting is enabled on a thread, calltd_thr_getinfo()for the thread and examine theti_traceme member of thetd_thrinfo_t structureit returns.
Thetd_thr_set_event() andtd_thr_clear_event() functions set and clear, respectively, a set ofevent types in the event mask associated with the threadth_p. Toinspect a thread's event mask, calltd_thr_getinfo() for the thread and examinetheti_events member of thetd_thrinfo_t structure it returns.
Thetd_ta_set_event() andtd_ta_clear_event() functions identical totd_thr_set_event() andtd_thr_clear_event(), respectively, exceptthat the target process's global event mask is modified. There isno provision for inspecting the value of a target process's global eventmask.
Thetd_thr_event_getmsg() function returns in *msg the event message associated with thread*th_p. Reading a thread's event message consumes the message, emptying the thread'sevent buffer. As noted above, each thread's event buffer holds at mostone event message; if a thread reports a second event before thefirst event message has been read, the second event message overwrites thefirst.
Thetd_ta_event_getmsg() function is identical totd_thr_event_getmsg(), except that it is passeda process handle rather than a thread handle. It selects some threadthat has an event message buffered and returns that thread's message. The thread selected is undefined, except that as long as at least onethread has an event message buffered, it returns an event message fromsome such thread.
Several macros are provided for manipulating event sets of typetd_thr_events_t:
Sets its argument to theNULL event set.
Sets its argument to the set of all events.
Adds a specific event type to an event set.
Deletes a specific event type from an event set.
Tests whether a specific event type is a member of an event set.
Tests whether an event set is theNULL set.
The following values may be returned for all thread event routines:
The call returned successfully.
An invalid thread handle was passed in.
An invalid internal process handle was passed.
There is aNULL external process handle associated with this internal process handle.
A call to one of the imported interface routines failed.
No event message was available to return totd_thr_event_getmsg() ortd_ta_event_getmsg().
Some other parameter error occurred, or alibc_db() internal error occurred.
The following value can be returned fortd_thr_event_enable(),td_thr_set_event(), andtd_thr_clear_event() only:
Because the agent thread in the target process has not completed initialization, this operation cannot be performed. The operation can be performed after the target process has been allowed to make some forward progress. Seelibc_db(3LIB).
Seeattributes(5) for description of the following attributes:
|
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |