[PATCH 3/5] score: Return prev state in thread state set/clear

Joel Sherrill joel.sherrill at oarcorp.com
Tue Mar 31 14:46:04 UTC 2015



On 3/31/2015 1:00 AM, Sebastian Huber wrote:
> ---
>  cpukit/score/include/rtems/score/threadimpl.h | 8 ++++++--
>  cpukit/score/src/threadclearstate.c           | 4 +++-
>  cpukit/score/src/threadsetstate.c             | 4 +++-
>  3 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
> index 551df45..dcbb71f 100644
> --- a/cpukit/score/include/rtems/score/threadimpl.h
> +++ b/cpukit/score/include/rtems/score/threadimpl.h
> @@ -248,11 +248,13 @@ void _Thread_Ready(
>   *  any necessary scheduling operations including the selection of
>   *  a new heir thread.
>   *
> + *  @return The previous state.
> + *
>   *  - INTERRUPT LATENCY:
>   *    + priority map
>   *    + select heir
>   */
> -void _Thread_Clear_state(
> +States_Control _Thread_Clear_state(
>    Thread_Control *the_thread,
>    States_Control  state
>  );
> @@ -267,11 +269,13 @@ void _Thread_Clear_state(
>   *  @param[in] the_thread is the thread to set the state for.
>   *  @param[in] state is the state to set the_thread to.
>   *
> + *  @return The previous state.
> + *
>   *  - INTERRUPT LATENCY:
>   *   + ready chain
>   *   + select map
>   */
I don't think this comment still applies after refactoring out the
scheduler.
Is there even a disable interrupt in this code now?
> -void _Thread_Set_state(
> +States_Control _Thread_Set_state(
>    Thread_Control *the_thread,
>    States_Control  state
>  );
> diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c
> index 3a79f35..00fb83a 100644
> --- a/cpukit/score/src/threadclearstate.c
> +++ b/cpukit/score/src/threadclearstate.c
> @@ -21,7 +21,7 @@
>  #include <rtems/score/threadimpl.h>
>  #include <rtems/score/schedulerimpl.h>
>  
> -void _Thread_Clear_state(
> +States_Control _Thread_Clear_state(
>    Thread_Control *the_thread,
>    States_Control  state
>  )
> @@ -41,4 +41,6 @@ void _Thread_Clear_state(
>    }
>  
>    _Scheduler_Release( the_thread, &lock_context );
> +
> +  return previous_state;
>  }
> diff --git a/cpukit/score/src/threadsetstate.c b/cpukit/score/src/threadsetstate.c
> index 8114d70..a10fc90 100644
> --- a/cpukit/score/src/threadsetstate.c
> +++ b/cpukit/score/src/threadsetstate.c
> @@ -24,7 +24,7 @@
>  #include <rtems/score/threadimpl.h>
>  #include <rtems/score/schedulerimpl.h>
>  
> -void _Thread_Set_state(
> +States_Control _Thread_Set_state(
>    Thread_Control *the_thread,
>    States_Control  state
>  )
> @@ -44,4 +44,6 @@ void _Thread_Set_state(
>    }
>  
>    _Scheduler_Release( the_thread, &lock_context );
> +
> +  return previous_state;
>  }

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the devel mailing list