From c9961bb2d4af8f3870bcf28c422752144ad5bf2e Mon Sep 17 00:00:00 2001 From: pirofti Date: Wed, 11 Apr 2012 10:18:46 +0000 Subject: Add pthread barrier support. Implementation and documentation for: - pthread_barrier_init() - pthread_barrier_destroy() - pthread_barrier_wait() - pthread_barrierattr_init() - pthread_barrierattr_destroy() - pthread_barrierattr_getpshared() - pthread_barrierattr_setpshared() Currently only private barriers are supported. Okay guenther@. --- lib/libpthread/include/pthread.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/libpthread/include/pthread.h') diff --git a/lib/libpthread/include/pthread.h b/lib/libpthread/include/pthread.h index 0a3cde4f753..0dccc5e91f6 100644 --- a/lib/libpthread/include/pthread.h +++ b/lib/libpthread/include/pthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread.h,v 1.32 2012/02/23 04:43:06 guenther Exp $ */ +/* $OpenBSD: pthread.h,v 1.33 2012/04/11 10:18:46 pirofti Exp $ */ /* * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu @@ -102,6 +102,11 @@ #define PTHREAD_CANCEL_ASYNCHRONOUS 2 #define PTHREAD_CANCELED ((void *) 1) +/* + * Barrier flags + */ +#define PTHREAD_BARRIER_SERIAL_THREAD -1 + /* * Forward structure definitions. * @@ -134,6 +139,8 @@ typedef volatile int pthread_key_t; typedef struct pthread_once pthread_once_t; typedef struct pthread_rwlock *pthread_rwlock_t; typedef struct pthread_rwlockattr *pthread_rwlockattr_t; +typedef struct pthread_barrier *pthread_barrier_t; +typedef struct pthread_barrierattr *pthread_barrierattr_t; /* * Additional type definitions: @@ -307,6 +314,14 @@ int pthread_setschedparam(pthread_t, int, const struct sched_param *); int pthread_getconcurrency(void); int pthread_setconcurrency(int); +int pthread_barrier_init(pthread_barrier_t *, + pthread_barrierattr_t *, unsigned int); +int pthread_barrier_destroy(pthread_barrier_t *); +int pthread_barrier_wait(pthread_barrier_t *); +int pthread_barrierattr_init(pthread_barrierattr_t *); +int pthread_barrierattr_destroy(pthread_barrierattr_t *); +int pthread_barrierattr_getpshared(pthread_barrierattr_t *, int *); +int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); __END_DECLS #endif /* _PTHREAD_H_ */ -- cgit v1.2.3-59-g8ed1b