diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-10-14 00:40:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-10-14 00:40:29 +0000 |
commit | 00e50680b1f067cfbbf46619138567314f5877d9 (patch) | |
tree | bb7c3429840b29b5ba23cbb6cae7d17dd72f8f86 /linuxthreads_db/td_ta_thr_iter.c | |
parent | 252470b60ff30bcb3b97bd8af81ced2ad8196342 (diff) | |
download | glibc-00e50680b1f067cfbbf46619138567314f5877d9.tar.gz |
Update.
1999-10-13 Ulrich Drepper <drepper@cygnus.com>
* td_ta_thr_iter.c: Use size of descriptor from *TA.
Don't return manager thread before it's actually running.
Actually use state parameter to distingusih at least a few states.
* td_thr_get_info.c: Handle manager thread special. Fill in ti_lid,
ti_state fields, and ti_startfunc fields.
Diffstat (limited to 'linuxthreads_db/td_ta_thr_iter.c')
-rw-r--r-- | linuxthreads_db/td_ta_thr_iter.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/linuxthreads_db/td_ta_thr_iter.c b/linuxthreads_db/td_ta_thr_iter.c index e25230c2b4..678dd7f01b 100644 --- a/linuxthreads_db/td_ta_thr_iter.c +++ b/linuxthreads_db/td_ta_thr_iter.c @@ -28,6 +28,7 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback, { struct pthread_handle_struct *handles = ta->handles; int pthread_threads_max = ta->pthread_threads_max; + size_t sizeof_descr = ta->sizeof_descr; int cnt; LOG (__FUNCTION__); @@ -46,10 +47,16 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback, struct _pthread_descr_struct pds; td_thrhandle_t th; - if (ps_pdread (ta->ph, phc.h_descr, &pds, - sizeof (struct _pthread_descr_struct)) != PS_OK) + if (ps_pdread (ta->ph, phc.h_descr, &pds, sizeof_descr) != PS_OK) return TD_ERR; /* XXX Other error value? */ + /* The manager thread must be handled special. The descriptor + exists but the thread only gets created when the first + `pthread_create' call is issued. A clear indication that + this happened is when the p_pid field is non-zero. */ + if (cnt == 1 && pds.p_pid == 0) + continue; + /* Now test whether this thread matches the specified conditions. */ @@ -57,6 +64,13 @@ td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback, if (pds.p_priority < ti_pri) continue; + /* Test the state. + XXX This is incomplete. */ + if (state != TD_THR_ANY_STATE + && (state != TD_THR_ZOMBIE || pds.p_exited == 0) + && (state != TD_THR_RUN || pds.p_exited != 0)) + continue; + /* Yep, it matches. Call the callback function. */ th.th_ta_p = (td_thragent_t *) ta; th.th_unique = phc.h_descr; |