[PATCH 2/2] Simplify get affinitiy directives

Gedare Bloom gedare at rtems.org
Tue Apr 27 16:05:14 UTC 2021


ok

On Mon, Apr 26, 2021 at 2:41 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> There is no need to disable thread dispatching to get the affinity of a
> task.
> ---
>  cpukit/posix/src/pthreadgetaffinitynp.c | 3 ---
>  cpukit/rtems/src/taskgetaffinity.c      | 3 ---
>  2 files changed, 6 deletions(-)
>
> diff --git a/cpukit/posix/src/pthreadgetaffinitynp.c b/cpukit/posix/src/pthreadgetaffinitynp.c
> index b904aea36c..f30ae54c2a 100644
> --- a/cpukit/posix/src/pthreadgetaffinitynp.c
> +++ b/cpukit/posix/src/pthreadgetaffinitynp.c
> @@ -38,7 +38,6 @@ int pthread_getaffinity_np(
>  {
>    Thread_Control   *the_thread;
>    ISR_lock_Context  lock_context;
> -  Per_CPU_Control  *cpu_self;
>    Status_Control    status;
>
>    if ( cpuset == NULL ) {
> @@ -51,7 +50,6 @@ int pthread_getaffinity_np(
>      return ESRCH;
>    }
>
> -  cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
>    _Thread_State_acquire_critical( the_thread, &lock_context );
>
>    status = _Scheduler_Get_affinity(
> @@ -61,7 +59,6 @@ int pthread_getaffinity_np(
>    );
>
>    _Thread_State_release( the_thread, &lock_context );
> -  _Thread_Dispatch_enable( cpu_self );
>    return _POSIX_Get_error( status );
>  }
>
> diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c
> index 6ced283393..09349c2da9 100644
> --- a/cpukit/rtems/src/taskgetaffinity.c
> +++ b/cpukit/rtems/src/taskgetaffinity.c
> @@ -33,7 +33,6 @@ rtems_status_code rtems_task_get_affinity(
>  {
>    Thread_Control   *the_thread;
>    ISR_lock_Context  lock_context;
> -  Per_CPU_Control  *cpu_self;
>    Status_Control    status;
>
>    if ( cpuset == NULL ) {
> @@ -52,7 +51,6 @@ rtems_status_code rtems_task_get_affinity(
>      return RTEMS_INVALID_ID;
>    }
>
> -  cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
>    _Thread_State_acquire_critical( the_thread, &lock_context );
>
>    status = _Scheduler_Get_affinity(
> @@ -62,6 +60,5 @@ rtems_status_code rtems_task_get_affinity(
>    );
>
>    _Thread_State_release( the_thread, &lock_context );
> -  _Thread_Dispatch_enable( cpu_self );
>    return _Status_Get( status );
>  }
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list