From 4fa84f10eca1f824649ca23cda57066bd085d4a0 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 19 Feb 2016 15:45:17 -0600 Subject: [PATCH] pthread.h, sys/types.h Add missing pthread methods * pthread.h: Add prototypes for pthread_condattr_getclock(), pthread_condattr_setclock(), pthread_setschedpri(), pthread_getcpuclockid(), pthread_getconcurrency(), and pthread_setconcurrency(). Also cleaned up file header to remove CVS Id string. * sys/types.h: Add clock ID to pthread_condattr_t. --- newlib/libc/include/pthread.h | 27 +++++++++++++++++++++------ newlib/libc/include/sys/types.h | 5 +++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h index 907970fdf..20df8e43b 100644 --- a/newlib/libc/include/pthread.h +++ b/newlib/libc/include/pthread.h @@ -1,8 +1,7 @@ -/* pthread.h +/* + * Written by Joel Sherrill . * - * Written by Joel Sherrill . - * - * COPYRIGHT (c) 1989-2013. + * COPYRIGHT (c) 1989-2013, 2015. * On-Line Applications Research Corporation (OAR). * * Permission to use, copy, modify, and distribute this software for any @@ -14,8 +13,6 @@ * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - * $Id$ */ #ifndef __PTHREAD_h @@ -96,6 +93,13 @@ int _EXFUN(pthread_mutex_timedlock, int _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr)); int _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr)); + +int _EXFUN(pthread_condattr_getclock, + (const pthread_condattr_t *__restrict __attr, + clockid_t *__restrict __clock_id)); +int _EXFUN(pthread_condattr_setclock, + (pthread_condattr_t *__attr, clockid_t __clock_id)); + int _EXFUN(pthread_condattr_getpshared, (_CONST pthread_condattr_t *__attr, int *__pshared)); int _EXFUN(pthread_condattr_setpshared, @@ -161,6 +165,9 @@ int _EXFUN(pthread_getschedparam, int _EXFUN(pthread_setschedparam, (pthread_t __pthread, int __policy, struct sched_param *__param)); +/* Set Scheduling Priority of a Thread */ +int _EXFUN(pthread_setschedprio, (pthread_t thread, int prio)); + #endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ #if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT) @@ -263,6 +270,14 @@ pthread_t _EXFUN(pthread_self, (void)); int _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2)); +/* Retrieve ID of a Thread's CPU Time Clock */ +int _EXFUN(pthread_getcpuclockid, + (pthread_t thread, clockid_t *clock_id)); + +/* Get/Set Current Thread's Concurrency Level */ +int _EXFUN(pthread_setconcurrency, (int new_level)); +int _EXFUN(pthread_getconcurrency, (void)); + /* Dynamic Package Initialization */ /* This is used to statically initialize a pthread_once_t. Example: diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index 1e0d07551..65e7b9bf5 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -409,9 +409,10 @@ typedef struct { typedef __uint32_t pthread_cond_t; /* identify a condition variable */ typedef struct { - int is_initialized; + int is_initialized; + clock_t clock; /* specifiy clock for timeouts */ #if defined(_POSIX_THREAD_PROCESS_SHARED) - int process_shared; /* allow this to be shared amongst processes */ + int process_shared; /* allow this to be shared amongst processes */ #endif } pthread_condattr_t; /* a condition attribute object */ -- 2.43.5