[PATCH] score: Simplify _Watchdog_Tick()

Joel Sherrill joel at rtems.org
Wed Feb 17 13:51:09 UTC 2016


This seems OK.

I think it is in sync with the simulator clock tick idle thread. But double
check.
On Feb 17, 2016 5:54 AM, "Sebastian Huber" <
sebastian.huber at embedded-brains.de> wrote:

> Move thread dispatch disable check to legacy rtems_clock_tick().  Assert
> that thread dispatching is disabled in _Watchdog_Tick().  This is
> usually the case, since this function is called in interrupt context by
> the clock tick service routine.
> ---
>  cpukit/rtems/src/clocktick.c    | 5 +++++
>  cpukit/score/src/watchdogtick.c | 8 ++++----
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/cpukit/rtems/src/clocktick.c b/cpukit/rtems/src/clocktick.c
> index a6bf26d..df8012e 100644
> --- a/cpukit/rtems/src/clocktick.c
> +++ b/cpukit/rtems/src/clocktick.c
> @@ -20,6 +20,7 @@
>
>  #include <rtems/rtems/clock.h>
>  #include <rtems/score/timecounter.h>
> +#include <rtems/score/threadimpl.h>
>
>  rtems_status_code rtems_clock_tick( void )
>  {
> @@ -32,5 +33,9 @@ rtems_status_code rtems_clock_tick( void )
>      &lock_context
>    );
>
> +  if ( _Thread_Dispatch_is_enabled() ) {
> +    _Thread_Dispatch();
> +  }
> +
>    return RTEMS_SUCCESSFUL;
>  }
> diff --git a/cpukit/score/src/watchdogtick.c
> b/cpukit/score/src/watchdogtick.c
> index b9bc3f7..cb68ea2 100644
> --- a/cpukit/score/src/watchdogtick.c
> +++ b/cpukit/score/src/watchdogtick.c
> @@ -12,8 +12,9 @@
>   * http://www.rtems.org/license/LICENSE.
>   */
>
> +#include <rtems/score/assert.h>
>  #include <rtems/score/schedulerimpl.h>
> -#include <rtems/score/threadimpl.h>
> +#include <rtems/score/threaddispatch.h>
>  #include <rtems/score/todimpl.h>
>  #include <rtems/score/watchdogimpl.h>
>
> @@ -23,12 +24,11 @@
>
>  void _Watchdog_Tick( void )
>  {
> +  _Assert( !_Thread_Dispatch_is_enabled() );
> +
>    _TOD_Tickle_ticks();
>
>    _Watchdog_Tickle_ticks();
>
>    _Scheduler_Tick();
> -
> -  if ( _Thread_Dispatch_is_enabled() )
> -    _Thread_Dispatch();
>  }
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160217/5af30c63/attachment-0002.html>


More information about the devel mailing list