Home | History | Annotate | Download | only in pthread_barrier_init
      1 /*
      2  * Copyright (c) 2002, Intel Corporation. All rights reserved.
      3  * This file is licensed under the GPL license.  For the full content
      4  * of this license, see the COPYING file at the top level of this
      5  * source tree.
      6  *
      7  * pthread_barrier_init()
      8  *
      9  *
     10  * The pthread_barrier_init() function shall fail if:
     11  * [EINVAL] The value specified by count is equal to zero.
     12  *
     13  */
     14 
     15 #define COUNT 0
     16 
     17 #define _XOPEN_SOURCE 600
     18 #include <pthread.h>
     19 #include <stdio.h>
     20 #include <stdlib.h>
     21 #include <unistd.h>
     22 #include <signal.h>
     23 #include <errno.h>
     24 #include <string.h>
     25 #include "posixtest.h"
     26 
     27 int main(void)
     28 {
     29 	int rc;
     30 	pthread_barrier_t barrier;
     31 
     32 	/* Intilized barrier with count 0 (it should return EINVAL) */
     33 
     34 	rc = pthread_barrier_init(&barrier, NULL, COUNT);
     35 
     36 	if (rc != EINVAL) {
     37 		printf
     38 		    ("Test FAILED: pthread_barrier_init() does not return EINVAL when intializing a barrier with count=0,"
     39 		     " return code %d, %s\n", rc, strerror(rc));
     40 		return PTS_FAIL;
     41 	}
     42 
     43 	printf("Test PASSED\n");
     44 	return PTS_PASS;
     45 }
     46