Changeset bc0078 in git for Singular/ssiLink.cc


Ignore:
Timestamp:
Mar 8, 2011, 11:52:46 AM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
8a9bcca97de899994799612c3fb8014a6b008467
Parents:
9803fba33946bae0120952e8ec3363d37dd5bc1a
Message:
error handling in slStatusSsiL

git-svn-id: file:///usr/local/Singular/svn/trunk@13943 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ssiLink.cc

    r9803fb rbc0078  
    606606        omFree(l->mode);
    607607        l->mode = omStrDup(mode);
    608         singular_in_batchmode=TRUE;
     608        singular_in_batchmode=TRUE;
    609609        SI_LINK_SET_RW_OPEN_P(l);
    610610        //myynest=0;
     
    11701170      int c=fgetc(d->f_read);
    11711171      //Print("try c=%d\n",c);
    1172       if (c== -1) return "eof";
     1172      if (c== -1) return "eof"; /* eof or error */
    11731173      else if (isdigit(c))
    11741174      { ungetc(c,d->f_read); d->ungetc_buf='\1'; return "ready"; }
     
    11961196int slStatusSsiL(lists L, int timeout)
    11971197{
    1198 // input: L: a list with snks of type
    1199 //           si-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
     1198// input: L: a list with links of type
     1199//           ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
    12001200//        timeout: timeout for select in micro-seconds
    12011201//           or -1 for infinity
     
    12621262  int s= select(max_fd, &mask, NULL, NULL, wt_ptr);
    12631263  if (s==-1) return -2; /*error*/
     1264  int j;
     1265  int retry_needed=0;
     1266find_next_fd:
    12641267  if (s==0)
    12651268  {
    1266     return 0; /*poll: not ready */
    1267   }
    1268   else /* s>0, at least one ready */
    1269   {
    1270     int j=0;
     1269    if (retry_needed)
     1270    {
     1271      // the os reported that one of the (ssi) links is ready,
     1272      // but it was only white space: this cannot happen again:
     1273      return slStatusSsiL(L,timeout);
     1274    }
     1275    else
     1276      return 0; /*poll: not ready */
     1277  }
     1278  else /* s>0, at least one ready  (the number of fd which are ready is s)*/
     1279  {
     1280    j=0;
    12711281    while (j<=max_fd) { if (FD_ISSET(j,&mask)) break; j++; }
    12721282    for(i=L->nr; i>=0; i--)
     
    13021312      int c=fgetc(d->f_read);
    13031313      //Print("try c=%d\n",c);
    1304       if (c== -1) return 0;
     1314      if (c== -1) /* eof or error*/
     1315      {
     1316        retry_needed=1;
     1317        FD_CLR(j,&mask);
     1318        s--;
     1319        goto find_next_fd;
     1320      }
    13051321      else if (isdigit(c))
    13061322      { ungetc(c,d->f_read); d->ungetc_buf='\1'; return i+1; }
Note: See TracChangeset for help on using the changeset viewer.