List:General Discussion« Previous MessageNext Message »
From:Harald Wellmann Date:May 4 1999 11:30am
Subject:Re: MySQL thread problem on HP
View as plain text  
The following patch seems to fix the timer problem. I have no clue if there are any
side-effects, in particular I wonder why machdep_start_timer gets called with
a negative argument to begin with.


struct itimerval.tv_sec is unsigned on HP-UX, so that the
condition !(timeout.it_interval.tv_usec < 0) was always true.

mysql-3.22.14b-gamma/mit-pthreads/pthreads/sleep.c:


int machdep_start_timer(struct timespec *current, struct timespec *wakeup)
{
        struct itimerval timeout;
        long             tv_sec;
        long             tv_usec;
        
        tv_usec = (wakeup->tv_nsec - current->tv_nsec) / 1000;
        tv_sec = wakeup->tv_sec - current->tv_sec;
        timeout.it_interval.tv_usec = 0;
        timeout.it_interval.tv_sec = 0;
        if (tv_usec < 0) {
                tv_usec += 1000000;
                tv_sec--;
        }

        if ((!(tv_sec < 0)) && ((tv_usec) || (tv_sec))) 
        {
            timeout.it_value.tv_sec  = tv_sec;
            timeout.it_value.tv_usec = tv_usec;
            
          if (setitimer(ITIMER_REAL, & timeout, NULL) < 0)
          {
            fprintf(stderr,"Got error %d from setitimer with:\n\
                    wakeup:   tv_sec: %ld  tv_nsec: %ld\n\
                    current:  tv_sec: %ld  tv_nsec: %ld\n\
                    argument: tv_sec: %ld  tv_usec: %ld\n",
                    errno,
                    wakeup->tv_sec, wakeup->tv_nsec,
                    current->tv_sec, current->tv_nsec,
                    timeout.it_value.tv_sec, timeout.it_value.tv_usec);
            PANIC();
          }
        } else {
                /*
                 * There is no time on the timer.
                 * This shouldn't happen,
                 * but isn't fatal.
                 */
                sig_handler_fake(SIGALRM);
        }
        return(OK);
}

--
Harald Wellmann
Lucent Technologies Network Systems Deutschland
GSM Software Development Support (FLI3)
Thurn-und-Taxis-Str. 10
90411 Nuernberg
GERMANY
Email   hwellmann@stripped
Phone   +49 911 526 4696
Fax     +49 911 526 3183
Thread
MySQL thread problem on HPG.J. Brendeke29 Apr
  • MySQL thread problem on HPMichael Widenius29 Apr
  • Re: MySQL thread problem on HPHarald Wellmann4 May
  • Re: MySQL thread problem on HP (2)Harald Wellmann4 May