From 610eefefddbf3537694b9ee43296a576e5e11b72 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 26 Sep 2008 16:15:50 +0000 Subject: [PATCH] 2008-09-25 Raphael Derossa Pereira * libc/include/pthread.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add new pthread_mutexattr_gettype and pthread_mutexattr_settype prototypes. * libc/include/sys/types.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add new mutex type values. (pthread_mutexattr_t)[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add type field. --- newlib/ChangeLog | 10 ++++++++++ newlib/libc/include/pthread.h | 11 +++++++++++ newlib/libc/include/sys/types.h | 14 ++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 0dee816a5..eb1f88b99 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,13 @@ +2008-09-25 Raphael Derossa Pereira + + * libc/include/pthread.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add + new pthread_mutexattr_gettype and pthread_mutexattr_settype + prototypes. + * libc/include/sys/types.h[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add + new mutex type values. + (pthread_mutexattr_t)[_UNIX98_THREAD_MUTEX_ATTRIBUTES]: Add type + field. + 2008-09-24 Jeff Johnston * libc/stdlib/setenv_r.c (_unsetenv_r): Modify to return -1 only if diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h index 1dc20bcc8..fccc14d70 100644 --- a/newlib/libc/include/pthread.h +++ b/newlib/libc/include/pthread.h @@ -57,6 +57,17 @@ int _EXFUN(pthread_mutexattr_getpshared, int _EXFUN(pthread_mutexattr_setpshared, (pthread_mutexattr_t *__attr, int __pshared)); +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) + +/* Single UNIX Specification 2 Mutex Attributes types */ + +int _EXFUN(pthread_mutexattr_gettype, + (_CONST pthread_mutexattr_t *__attr, int *__kind)); +int _EXFUN(pthread_mutexattr_settype, + (pthread_mutexattr_t *__attr, int __kind)); + +#endif + /* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */ int _EXFUN(pthread_mutex_init, diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index 1813bdda8..3f1893c20 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -323,6 +323,17 @@ typedef struct { #define PTHREAD_PRIO_PROTECT 2 #endif +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) + +/* Values for mutex type */ + +#define PTHREAD_MUTEX_NORMAL 0 +#define PTHREAD_MUTEX_RECURSIVE 1 +#define PTHREAD_MUTEX_ERRORCHECK 2 +#define PTHREAD_MUTEX_DEFAULT 3 + +#endif + typedef __uint32_t pthread_mutex_t; /* identify a mutex */ typedef struct { @@ -333,6 +344,9 @@ typedef struct { #if defined(_POSIX_THREAD_PRIO_PROTECT) int prio_ceiling; int protocol; +#endif +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) + int type; #endif int recursive; } pthread_mutexattr_t;