_TOD_Set lock release question

Joel Sherrill joel at rtems.org
Wed Dec 4 03:04:34 UTC 2019


Hi

_TOD_Set() currently can't fail. With the addition of the TOD hooks, if a
BSP hook returns false, then _TOD_Set will fail. This requires that the lock
acquired by _TOD_Acquire before _TOD_Set is invoked as in rtems_clock_set()
should be released on the failure path.  I don't see a _TOD_Release method.
What method needs to be invoked on the hook error path?

=====================================
bool _TOD_Set(
  const struct timespec *tod,
  ISR_lock_Context      *lock_context
)
{
  struct bintime  tod_as_bintime;
  uint64_t        tod_as_ticks;
  uint32_t        cpu_max;
  uint32_t        cpu_index;
  bool            retval;

  _Assert( _TOD_Is_owner() );

  retval = _TOD_Hook_Run( TOD_ACTION_SET_CLOCK, tod );
  if ( retval == false ) {
    // XXX what  to release???
    return false;
  }

  timespec2bintime( tod, &tod_as_bintime );
  _Timecounter_Set_clock( &tod_as_bintime, lock_context );
=====================================

Thanks

--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20191203/c99ee51b/attachment.html>


More information about the devel mailing list