Changeset 5179a0 in git


Ignore:
Timestamp:
Jul 29, 2013, 6:33:46 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
a4480646ef09cf15409cf635907aae92d5e81d7c
Parents:
cca4407deeb250aa255ceccd313c30b53dfd49f2
Message:
fix: signal handling stuff
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/links/ssiLink.cc

    rcca4407 r5179a0  
    7272
    7373#ifdef HAVE_SIMPLEIPC
    74 #include <Singular/simpleipc.h>
     74#include <Singular/links/simpleipc.h>
    7575#endif
    7676//#if (_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)
     
    15651565  si_link l;
    15661566  ssiInfo *d;
    1567   #ifdef HAVE_MPSR
    1568   MP_Link_pt dd;
    1569   #endif
    15701567  int d_fd;
    15711568  fd_set  mask, fdmask;
     
    15751572
    15761573  /* timeout */
    1577   #ifdef HAVE_PSELECT
    1578   struct timespec wt;
    1579   struct timespec *wt_ptr=&wt;
    1580   #else
    15811574  struct timeval wt;
    15821575  struct timeval *wt_ptr=&wt;
    1583   #endif
    15841576  int startingtime = getRTimer()/TIMER_RESOLUTION;  // in seconds
    15851577  if (timeout== -1)
     
    15901582  {
    15911583    wt.tv_sec  = timeout / 1000000;
    1592   #ifdef HAVE_PSELECT
    1593     wt.tv_nsec = 1000 * (timeout % 1000000);
    1594   #else
    15951584    wt.tv_usec = timeout % 1000000;
    1596   #endif
    1597   }
    1598 
    1599   /* signal mask for pselect() */
    1600   sigset_t sigmask;
    1601   if(sigprocmask(SIG_SETMASK, NULL, &sigmask) < 0)
    1602   {
    1603     WerrorS("error in sigprocmask()");
    1604     return -2;
    1605   }
    1606   if(sigaddset(&sigmask, SIGCHLD) < 0)
    1607   {
    1608     WerrorS("error in sigaddset()");
    1609     return -2;
    16101585  }
    16111586
     
    16321607        && (strcmp(l->mode,"launch")!=0) && (strcmp(l->mode,"connect")!=0)))
    16331608      {
    1634         WerrorS("all links must be of type ssi:fork, ssi:tcp, ssi:connect,");
    1635         WerrorS(" MPtcp:fork or MPtcp:launch");
     1609        WerrorS("all links must be of type ssi:fork, ssi:tcp, ssi:connect");
    16361610        return -2;
    16371611      }
    1638     #ifdef HAVE_MPSR
    1639       if (strcmp(l->m->type,"ssi")==0)
    1640       {
    1641         d=(ssiInfo*)l->data;
    1642         d_fd=d->fd_read;
    1643         if (!s_isready(d->f_read))
    1644         {
    1645           FD_SET(d_fd, &fdmask);
    1646           if (d_fd > max_fd) max_fd=d_fd;
    1647         }
    1648         else
    1649           return i+1;
    1650       }
    1651       else
    1652       {
    1653         dd=(MP_Link_pt)l->data;
    1654         d_fd=((MP_TCP_t *)dd->transp.private1)->sock;
    1655         FD_SET(d_fd, &fdmask);
    1656         if (d_fd > max_fd) max_fd=d_fd;
    1657       }
    1658     #else
    16591612      d=(ssiInfo*)l->data;
    16601613      d_fd=d->fd_read;
     
    16661619      else
    16671620        return i+1;
    1668     #endif
    16691621    }
    16701622  }
     
    16861638  sipc_semaphore_release(0);
    16871639  #endif
    1688   #ifdef HAVE_PSELECT
    1689   s = si_pselect(max_fd, &mask, NULL, NULL, wt_ptr, &sigmask);
    1690   #else
    1691   SSI_BLOCK_CHLD;
    16921640  s = si_select(max_fd, &mask, NULL, NULL, wt_ptr);
    1693   SSI_UNBLOCK_CHLD;
    1694   #endif
    16951641  #ifdef HAVE_SIMPLEIPC
    16961642  sipc_semaphore_acquire(0);
     
    17151661      {
    17161662        l=(si_link)L->m[i].Data();
    1717         #ifdef HAVE_MPSR
    1718         if (strcmp(l->m->type,"ssi")!=0)
    1719         {
    1720           // for MP links, return here:
    1721           dd=(MP_Link_pt)l->data;
    1722           d_fd=((MP_TCP_t *)dd->transp.private1)->sock;
    1723           if(j==d_fd) return i+1;
    1724         }
    1725         else
    1726         {
    1727           d=(ssiInfo*)l->data;
    1728           d_fd=d->fd_read;
    1729           if(j==d_fd) break;
    1730         }
    1731         #else
    17321663        d=(ssiInfo*)l->data;
    17331664        d_fd=d->fd_read;
    17341665        if(j==d_fd) break;
    1735         #endif
    17361666      }
    17371667    }
     
    17651695             timeout - 1000000*(getRTimer()/TIMER_RESOLUTION - startingtime));
    17661696          wt.tv_sec  = timeout / 1000000;
    1767           #ifdef HAVE_PSELECT
    1768           wt.tv_nsec = 1000 * (timeout % 1000000);
    1769           #else
    17701697          wt.tv_usec = (timeout % 1000000);
    1771           #endif
    17721698        }
    17731699        goto do_select;
  • configure.ac

    rcca4407 r5179a0  
    3434
    3535AC_HEADER_STDC
    36 AC_CHECK_HEADERS(unistd.h iostream.h)
     36AC_CHECK_HEADERS(unistd.h iostream.h sys/time.h sys/times.h asm/sigcontext.h)
    3737
    38 AC_CHECK_FUNCS(readlink getcwd getwd setenv putenv)
     38AC_CHECK_FUNCS(readlink getcwd getwd setenv putenv pselect)
    3939
    4040
  • kernel/mod2.h

    rcca4407 r5179a0  
    5656
    5757#endif
     58
     59/* include simpleipc/semaphore code, link against librt/libpthread */
     60#define HAVE_SIMPLEIPC 1
     61
    5862
    5963/* linear algebra extensions from pcv.h/pcv.cc */
Note: See TracChangeset for help on using the changeset viewer.