Home | History | Annotate | Download | only in pthread_condattr_init
      1 /*
      2  * Copyright (c) 2002, Intel Corporation. All rights reserved.
      3  * Created by:  bing.wei.liu REMOVE-THIS AT intel DOT com
      4  * This file is licensed under the GPL license.  For the full content
      5  * of this license, see the COPYING file at the top level of this
      6  * source tree.
      7 
      8  * Test that pthread_condattr_init()
      9  *   Upon successful completion, pthread_condattr_init() shall return a value of 0.
     10 
     11  * Steps:
     12  * 1.  Initialize a pthread_condattr_t object with pthread_condattr_init()
     13  * 2.  ENOMEM is the only error it returns, so if it doesn't return that error,
     14  *     the return number should be 0.
     15  */
     16 
     17 #include <pthread.h>
     18 #include <stdio.h>
     19 #include <errno.h>
     20 #include "posixtest.h"
     21 
     22 int main(void)
     23 {
     24 	pthread_condattr_t condattr;
     25 	int rc;
     26 
     27 	/* Initialize a condition variable attributes object */
     28 	if ((rc = pthread_condattr_init(&condattr)) == 0) {
     29 		printf("Test PASSED\n");
     30 		return PTS_PASS;
     31 	}
     32 
     33 	/* Insufficient memory exists to initialize the condition variable attributes object */
     34 	else if (rc == ENOMEM) {
     35 		fprintf(stderr, "pthread_condattr_init() returns ENOMEM\n");
     36 		return PTS_UNRESOLVED;
     37 	}
     38 
     39 	/* Any other returned value means the test failed */
     40 	else {
     41 		printf("Test FAILED\n");
     42 		return PTS_FAIL;
     43 	}
     44 }
     45