[ntp:questions] NEED_PTHREAD_WARMUP section in ntpd/ntpd.c

Sundeep Lal sundeep.lal at outlook.com
Wed Feb 22 17:06:51 UTC 2017


Starting with ntp-4.2.8p4 a new section was added to ntp-4.2.8p4/ntpd/ntpd.c at line 273:

#ifdef NEED_PTHREAD_WARMUP
static void*
my_pthread_warmup_worker(void *thread_args)
{
..
..
}

..
..
#endif

The my_pthread_warmup_worker() thread function does not make use of pthread_setcancelstate() and pthread_setcanceltype(), and in some uclibc based systems this causes the pthread_cancel() call on line 299 to take no effect. Then, in line 300 when pthread_join() is invoked, ntpd forever remains in my_pthread_warmup_worker() thread. For such uclibc systems, we should add the following lines to my_pthread_warmup_worker():

static void*
my_pthread_warmup_worker(void *thread_args)
{
  pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
  (void)thread_args;
  ..
  ..
}

My question is: has the above already been reported in any bug? I could not find any pull request for the same.

Thanks!
- S.L.


More information about the questions mailing list