[RTEMS Project] #3175: Merge FreeBSD timecounter changes from 2015-01-20 to now

RTEMS trac trac at rtems.org
Thu Oct 12 05:09:57 UTC 2017


#3175: Merge FreeBSD timecounter changes from 2015-01-20 to now
-----------------------------+------------------------------
 Reporter:  Sebastian Huber  |       Owner:  Sebastian Huber
     Type:  enhancement      |      Status:  assigned
 Priority:  normal           |   Milestone:  4.12.0
Component:  score            |     Version:  4.12
 Severity:  normal           |  Resolution:
 Keywords:                   |
-----------------------------+------------------------------

Comment (by Eric van Gyzen <vangyzen@…>):

 In [changeset:"952b42b643d66fbc88d45d51e4572102c9c00ba9/rtems"
 952b42b6/rtems]:
 {{{
 #!CommitTicketReference repository="rtems"
 revision="952b42b643d66fbc88d45d51e4572102c9c00ba9"
 timecounter: Merge FreeBSD change r315280

 When the RTC is adjusted, reevaluate absolute sleep times based on the RTC

 POSIX 2008 says this about clock_settime(2):

     If the value of the CLOCK_REALTIME clock is set via clock_settime(),
     the new value of the clock shall be used to determine the time
     of expiration for absolute time services based upon the
     CLOCK_REALTIME clock.  This applies to the time at which armed
     absolute timers expire.  If the absolute time requested at the
     invocation of such a time service is before the new value of
     the clock, the time service shall expire immediately as if the
     clock had reached the requested time normally.

     Setting the value of the CLOCK_REALTIME clock via clock_settime()
     shall have no effect on threads that are blocked waiting for
     a relative time service based upon this clock, including the
     nanosleep() function; nor on the expiration of relative timers
     based upon this clock.  Consequently, these time services shall
     expire when the requested relative interval elapses, independently
     of the new or old value of the clock.

 When the real-time clock is adjusted, such as by clock_settime(3),
 wake any threads sleeping until an absolute real-clock time.
 Such a sleep is indicated by a non-zero td_rtcgen.  The sleep functions
 will set that field to zero and return zero to tell the caller
 to reevaluate its sleep duration based on the new value of the clock.

 At present, this affects the following functions:

     pthread_cond_timedwait(3)
     pthread_mutex_timedlock(3)
     pthread_rwlock_timedrdlock(3)
     pthread_rwlock_timedwrlock(3)
     sem_timedwait(3)
     sem_clockwait_np(3)

 I'm working on adding clock_nanosleep(2), which will also be affected.

 Reported by:    Sebastian Huber <sebastian.huber at embedded-brains.de>
 Reviewed by:    jhb, kib
 MFC after:      2 weeks
 Relnotes:       yes
 Sponsored by:   Dell EMC
 Differential Revision:  https://reviews.freebsd.org/D9791

 Update #3175.
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/3175#comment:21>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list