All pastes #249882 Raw Edit

Anonymous

public text v1 · immutable
#249882 ·published 2006-11-16 08:35 UTC
rendered paste body
int
UlawToneSupplier (char *filedbuf, int *flen)
{
  pthread_t tid;
  int itmp;

  tid = pthread_self();
  for(itmp=0;itmp<MAXPORTS;itmp++)
    if( hwhandles[itmp]->tonesuptid == tid )
        break;
  if( itmp == MAXPORTS ) {
        *flen = 0;
        return 0;
  }
  if ((cbufpos[itmp] + 160) > cbufsize[itmp])
    cbufpos[itmp] = 0;
  if ( supdialtone[itmp] )
    {
      memcpy (filedbuf, (cbuf[itmp] + cbufpos[itmp]), 160);
      *flen = 160;
      cbufpos[itmp] += 160;
    }
  else
    {
      /* sometimes this may eatup cpu resources in idle, take care */
      usleep (1);
      *flen = 0;
    }
  return 0;
}