int UlawToneSupplier (char *filedbuf, int *flen) { pthread_t tid; int itmp; tid = pthread_self(); for(itmp=0;itmptonesuptid == 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; }