diff options
author | Václav Haisman <vhaisman@gmail.com> | 2016-02-12 22:25:59 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-02-13 16:03:15 +0100 |
commit | 813da84442d7c742fccdfa8cb517757cc39eec68 (patch) | |
tree | 8e264e4047f14fde57686b88a0739c9063f98cb6 /newlib/libc | |
parent | ef64aa4940e1d9120875a74f37b8419680f535e3 (diff) | |
download | cygnal-813da84442d7c742fccdfa8cb517757cc39eec68.tar.gz cygnal-813da84442d7c742fccdfa8cb517757cc39eec68.tar.bz2 cygnal-813da84442d7c742fccdfa8cb517757cc39eec68.zip |
POSIX barrier implementation, take 3
The attached patch should address all of the review comments.
Modifed change log:
Newlib:
* libc/include/sys/features.h (_POSIX_BARRIERS): Define for Cygwin.
* libc/include/sys/types.h (pthread_barrier_t)
(pthread_barrierattr_t): Do not define for Cygwin.
Cygwin:
* common.din (pthread_barrierattr_init)
(pthread_barrierattr_setpshared, pthread_barrierattr_getpshared)
(pthread_barrierattr_destroy, pthread_barrier_init)
(pthread_barrier_destroy, pthread_barrier_wait): Export.
* include/cygwin/types.h (pthread_barrierattr_t)
(pthread_barrier_t): Declare.
* include/pthread.h (PTHREAD_BARRIER_SERIAL_THREAD)
(pthread_barrierattr_init, pthread_barrierattr_setpshared)
(pthread_barrierattr_getpshared, pthread_barrierattr_destroy)
(pthread_barrier_init, pthread_barrier_destroy)
(pthread_barrier_wait): Declare.
* thread.h (PTHREAD_BARRIER_MAGIC)
(PTHREAD_BARRIERATTR_MAGIC): Define.
(class pthread_barrierattr, class pthread_barrier): Declare.
* thread.cc (delete_and_clear): New local helper function.
(class pthread_barrierattr, class pthread_barrier): Implement.
* miscfuncs.h (likely, unlikely): New macros.
--
VH
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/include/sys/features.h | 6 | ||||
-rw-r--r-- | newlib/libc/include/sys/types.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 4ad7fbdca..0c6043cf9 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -118,10 +118,10 @@ extern "C" { #define _POSIX_ADVISORY_INFO 200112L /* #define _POSIX_ASYNCHRONOUS_IO -1 */ -/* #define _POSIX_BARRIERS -1 */ +#define _POSIX_BARRIERS 200112L #define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CLOCK_SELECTION 200112L -#define _POSIX_CPUTIME 200112L +#define _POSIX_CPUTIME 200112L #define _POSIX_FSYNC 200112L #define _POSIX_IPV6 200112L #define _POSIX_JOB_CONTROL 1 @@ -140,7 +140,7 @@ extern "C" { #define _POSIX_REGEXP 1 #define _POSIX_SAVED_IDS 1 #define _POSIX_SEMAPHORES 200112L -#define _POSIX_SHARED_MEMORY_OBJECTS 200112L +#define _POSIX_SHARED_MEMORY_OBJECTS 200112L #define _POSIX_SHELL 1 /* #define _POSIX_SPAWN -1 */ #define _POSIX_SPIN_LOCKS 200112L diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index 5dd6c75fe..1e0d07551 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -431,6 +431,7 @@ typedef struct { /* POSIX Barrier Types */ +#if !defined(__CYGWIN__) #if defined(_POSIX_BARRIERS) typedef __uint32_t pthread_barrier_t; /* POSIX Barrier Object */ typedef struct { @@ -443,7 +444,6 @@ typedef struct { /* POSIX Spin Lock Types */ -#if !defined (__CYGWIN__) #if defined(_POSIX_SPIN_LOCKS) typedef __uint32_t pthread_spinlock_t; /* POSIX Spin Lock Object */ #endif /* defined(_POSIX_SPIN_LOCKS) */ |