for (cnt = 0; cnt < pthread_threads_max && num > 0; ++cnt)
for (cnt = 2; cnt < pthread_threads_max && num > 0; ++cnt)
td_ta_thr_iter (const td_thragent_t *ta, td_thr_iter_f *callback,		void *cbdata_p, td_thr_state_e state, int ti_pri,		sigset_t *ti_sigmask_p, unsigned int ti_user_flags){  int pthread_threads_max;  struct pthread_handle_struct *phc;  td_err_e result = TD_OK;  int cnt;#ifdef ALL_THREADS_STOPPED  int num;#else# define num 1#endif  LOG (__FUNCTION__);  /* Test whether the TA parameter is ok.  */  if (! ta_ok (ta))    return TD_BADTA;  pthread_threads_max = ta->pthread_threads_max;  phc = (struct pthread_handle_struct *) alloca (sizeof (phc[0])						 * pthread_threads_max);  /* First read only the main thread and manager thread information.  */  if (ps_pdread (ta->ph, ta->handles, phc,		 sizeof (struct pthread_handle_struct) * 2) != PS_OK)    return TD_ERR;	/* XXX Other error value?  */  /* Now handle these descriptors.  */  result = handle_descr (ta, callback, cbdata_p, state, ti_pri, 0,			 phc[0].h_descr);  if (result != TD_OK)    return result;  result = handle_descr (ta, callback, cbdata_p, state, ti_pri, 1,			 phc[1].h_descr);  if (result != TD_OK)    return result;  /* Read all the descriptors.  */  if (ps_pdread (ta->ph, ta->handles, &phc[2],		 (sizeof (struct pthread_handle_struct)		  * (pthread_threads_max - 2))) != PS_OK)    return TD_ERR;	/* XXX Other error value?  */#ifdef ALL_THREADS_STOPPED  /* Read the number of currently active threads.  */  if (ps_pdread (ta->ph, ta->pthread_handles_num, &num, sizeof (int)) != PS_OK)    return TD_ERR;	/* XXX Other error value?  */#endif  /* Now get all descriptors, one after the other.  */  for (cnt = 0; cnt < pthread_threads_max && num > 0; ++cnt)    if (phc[cnt].h_descr != NULL)      {	result = handle_descr (ta, callback, cbdata_p, state, ti_pri, cnt,			       phc[cnt].h_descr);	if (result != TD_OK)	  break;      }  return result;}