thr_barrier.c (619f4fce790c37b38e414f46bda1dda464470c0d) | thr_barrier.c (37a6356bbed1e94fd2b0d9d02a29508465584c19) |
---|---|
1/*- 2 * Copyright (c) 2003 David Xu <davidxu@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 | 1/*- 2 * Copyright (c) 2003 David Xu <davidxu@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28 |
29#include "namespace.h" |
|
29#include <errno.h> 30#include <stdlib.h> 31#include <pthread.h> | 30#include <errno.h> 31#include <stdlib.h> 32#include <pthread.h> |
33#include "un-namespace.h" |
|
32 33#include "thr_private.h" 34 35__weak_reference(_pthread_barrier_init, pthread_barrier_init); 36__weak_reference(_pthread_barrier_wait, pthread_barrier_wait); 37__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy); 38 39int --- 9 unchanged lines hidden (view full) --- 49 return (EBUSY); 50 *barrier = NULL; 51 free(bar); 52 return (0); 53} 54 55int 56_pthread_barrier_init(pthread_barrier_t *barrier, | 34 35#include "thr_private.h" 36 37__weak_reference(_pthread_barrier_init, pthread_barrier_init); 38__weak_reference(_pthread_barrier_wait, pthread_barrier_wait); 39__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy); 40 41int --- 9 unchanged lines hidden (view full) --- 51 return (EBUSY); 52 *barrier = NULL; 53 free(bar); 54 return (0); 55} 56 57int 58_pthread_barrier_init(pthread_barrier_t *barrier, |
57 const pthread_barrierattr_t *attr, int count) | 59 const pthread_barrierattr_t *attr, unsigned count) |
58{ 59 pthread_barrier_t bar; 60 | 60{ 61 pthread_barrier_t bar; 62 |
63 (void)attr; 64 |
|
61 if (barrier == NULL || count <= 0) 62 return (EINVAL); 63 64 bar = malloc(sizeof(struct pthread_barrier)); 65 if (bar == NULL) 66 return (ENOMEM); 67 68 _thr_umtx_init(&bar->b_lock); --- 39 unchanged lines hidden --- | 65 if (barrier == NULL || count <= 0) 66 return (EINVAL); 67 68 bar = malloc(sizeof(struct pthread_barrier)); 69 if (bar == NULL) 70 return (ENOMEM); 71 72 _thr_umtx_init(&bar->b_lock); --- 39 unchanged lines hidden --- |