[PATCH 02/32] score: Delete redundant thread life enums

Gedare Bloom gedare at rtems.org
Thu May 19 22:33:42 UTC 2016


On Wed, May 18, 2016 at 5:20 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> This makes it easier to add more states in the future.
>
> Update #2555.
> Update #2626.
> ---
>  cpukit/score/include/rtems/score/thread.h     | 6 +-----
>  cpukit/score/include/rtems/score/threadimpl.h | 3 ++-
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
> index b8e0e00..37bf779 100644
> --- a/cpukit/score/include/rtems/score/thread.h
> +++ b/cpukit/score/include/rtems/score/thread.h
> @@ -523,11 +523,7 @@ typedef enum {
>    THREAD_LIFE_NORMAL = 0x0,
>    THREAD_LIFE_PROTECTED = 0x1,
>    THREAD_LIFE_RESTARTING = 0x2,
> -  THREAD_LIFE_PROTECTED_RESTARTING = 0x3,
> -  THREAD_LIFE_TERMINATING = 0x4,
> -  THREAD_LIFE_PROTECTED_TERMINATING = 0x5,
> -  THREAD_LIFE_RESTARTING_TERMINATING = 0x6,
> -  THREAD_LIFE_PROTECTED_RESTARTING_TERMINATING = 0x7
> +  THREAD_LIFE_TERMINATING = 0x4
>  } Thread_Life_state;
>
Ensure the doc for this enum says the values should be powers of 2?

>  /**
> diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
> index 1ea49dd..3fdc2e8 100644
> --- a/cpukit/score/include/rtems/score/threadimpl.h
> +++ b/cpukit/score/include/rtems/score/threadimpl.h
> @@ -943,7 +943,8 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing(
>    Thread_Life_state life_state
>  )
>  {
> -  return ( life_state & THREAD_LIFE_RESTARTING_TERMINATING ) != 0;
> +  return ( life_state
> +    & ( THREAD_LIFE_RESTARTING | THREAD_LIFE_TERMINATING ) ) != 0;
>  }
>
>  /**
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list