20th call to dx_stopch hangs

From: General Listmanager <General.listmanager@pysdiscussext.py.intel.com>
Date: Sun May 23 2004 - 16:23:56 EDT

From: Chad Fox

I have seen similar post, but none of them seemed to have answers. I am calling dx_stopch on an async play. The first 19 calls are successful, but the 20th call just hangs. I tried using an async stopch and checking ATDX_STATE, but that function call fails with (IO function timeout) on the 20th call.

Here is a small program that demonstrates the problem.
(I am using SR 5.1 on the Red Hat 7.3 system)

#include <stdio.h>
#include <fcntl.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <sys/time.h>

DV_TPT play_tpt[1];

int main(){
  int dev;
  int x;
  DX_IOTT iott;

  iott.io_type = IO_DEV|IO_EOT;
  iott.io_fhandle = open("rec_slot/c111", O_RDONLY);
  if(iott.io_fhandle == -1){ printf("foo\n"); return 1; }
  iott.io_length = -1;
  iott.io_offset = 0;

  if((dev = dx_open("dxxxB1C1",(int)NULL)) == -1) {
     fprintf(stderr,"Failed to open Channel\n");
     return 1;
  }

  dx_clrtpt(play_tpt,1);
  play_tpt[0].tp_type = IO_EOT;
  play_tpt[0].tp_termno = DX_LCOFF;
  play_tpt[0].tp_length = 1;
  play_tpt[0].tp_flags = TF_LCOFF;

  dx_sethook(dev,DX_ONHOOK,EV_SYNC);

  if(dx_wtring(dev,1,DX_OFFHOOK,-1) == -1) {
     printf("Error waiting for ring - %s\n", ATDV_LASTERR(dev));
     return 1;
  }
  if (dx_play(dev,&iott,play_tpt,EV_ASYNC|PM_SR8) == -1) {
     fprintf(stderr,"missing voice\n");
  }

  x = 0;

  while(1){

        usleep(500000);

        while(ATDX_STATE(dev) == CS_IDLE) usleep(50000);
        if(dx_stopch(dev,EV_SYNC|EV_NOSTOP)==-1){
            fprintf(stderr,"stopch failed\n");
        } else {
            fprintf(stderr,"stopch worked: %d\n",x++);
        }
       if (dx_play(dev,&iott,play_tpt,EV_ASYNC|PM_SR8) == -1) {
           fprintf(stderr,"missing voice\n");
       }
  }

  return 1;
}

-

To reply: mailto:General.28397@pysdiscussext.py.intel.com
To start a new topic: mailto:General@pysdiscussext.py.intel.com
To login: http://members.support.dialogic.com/wbproxy/wbpx.dll/~general
Received on Sun May 23 15:33:12 2004

This archive was generated by hypermail 2.1.8 : Sat Jul 16 2005 - 03:48:32 EDT