[PATCH] pthreadgetcpuclockid.c: Implement pthread_getcpuclockid to return thread Id
Eshan Dhawan
eshandhawan51 at gmail.com
Sun Apr 5 10:02:37 UTC 2020
Is this patch pushed?
where will its test be added?
:)
thanks
- Eshan
On Fri, Mar 13, 2020 at 1:30 AM Joel Sherrill <joel at rtems.org> wrote:
> ---
> cpukit/posix/src/pthreadgetcpuclockid.c | 31
> ++++++++++++++++++++++++++-----
> 1 file changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/cpukit/posix/src/pthreadgetcpuclockid.c
> b/cpukit/posix/src/pthreadgetcpuclockid.c
> index cd7814b..c15962e 100644
> --- a/cpukit/posix/src/pthreadgetcpuclockid.c
> +++ b/cpukit/posix/src/pthreadgetcpuclockid.c
> @@ -7,8 +7,10 @@
>
> /*
> * 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/Draft 8, p. 58
> - *
> - * COPYRIGHT (c) 1989-2007.
> + */
> +
> +/*
> + * COPYRIGHT (c) 1989-2007,2020.
> * On-Line Applications Research Corporation (OAR).
> *
> * The license and distribution terms for this file may be
> @@ -23,12 +25,31 @@
> #include <pthread.h>
> #include <errno.h>
>
> -#include <rtems/seterr.h>
> +#include <rtems/score/threadimpl.h>
>
> int pthread_getcpuclockid(
> - pthread_t pid,
> + pthread_t thread,
> clockid_t *clock_id
> )
> {
> - rtems_set_errno_and_return_minus_one( ENOSYS );
> + Thread_Control *the_thread;
> + ISR_lock_Context lock_context;
> +
> + if ( clock_id == NULL ) {
> + return EINVAL;
> + }
> +
> + the_thread = _Thread_Get( thread, &lock_context );
> +
> + if ( the_thread == NULL ) {
> + return ESRCH;
> + }
> +
> + _Thread_State_acquire_critical( the_thread, &lock_context );
> +
> + *clock_id = the_thread->Object.id;
> +
> + _Thread_State_release( the_thread, &lock_context );
> +
> + return 0;
> }
> --
> 1.8.3.1
>
> _______________________________________________
> 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/20200405/6d546113/attachment.html>
More information about the devel
mailing list