Changeset d9c46b in git


Ignore:
Timestamp:
Nov 27, 2013, 1:53:56 PM (9 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '5bec8f88c9ee2573d328cf7c3aff2bcb301d2395')
Children:
f3b9c8218927971b73c98bdad2d70edd385dbc67
Parents:
aee346d01140a3cd0f7a969421b69db5fece8efd
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2013-11-27 13:53:56+01:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2013-11-27 14:25:09+01:00
Message:
chg: restart nanosleep when interrupted by signal
(cherry picked from commit f9efe23dee0924e650e1aefea029b4add8fcc7e9)

Signed-off-by: Andreas Steenpass <steenpass@mathematik.uni-kl.de>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/links/ssiLink.cc

    raee346d rd9c46b  
    11401140        t.tv_sec=0;
    11411141        t.tv_nsec=100000000; // <=100 ms
    1142         int r=si_nanosleep(&t,NULL);
    1143         if((r==0) && (si_waitpid(d->pid,NULL,WNOHANG)==0))
     1142        struct timespec rem;
     1143        int r;
     1144        int wait;
     1145        do
     1146        {
     1147          r = nanosleep(&t, &rem);
     1148          t = rem;
     1149        } while ((r < 0) && (errno == EINTR)
     1150            && ((wait = si_waitpid(d->pid,NULL,WNOHANG)) == 0));
     1151        if ((r == 0) && (wait == 0))
    11441152        {
    11451153          kill(d->pid,15);
    11461154          t.tv_sec=5; // <=5s
    11471155          t.tv_nsec=0;
    1148           r=si_nanosleep(&t,NULL);
    1149           if((r==0)&&(si_waitpid(d->pid,NULL,WNOHANG)==0))
     1156          do
     1157          {
     1158            r = nanosleep(&t, &rem);
     1159            t = rem;
     1160          } while ((r < 0) && (errno == EINTR)
     1161              && ((wait = si_waitpid(d->pid,NULL,WNOHANG)) == 0));
     1162          if ((r == 0) && (wait == 0))
    11501163          {
    11511164            kill(d->pid,9); // just to be sure
Note: See TracChangeset for help on using the changeset viewer.