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 22int main() 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 { 30 printf("Test PASSED\n"); 31 return PTS_PASS; 32 } 33 34 /* Insufficient memory exists to initialize the condition variable attributes object */ 35 else if(rc == ENOMEM) 36 { 37 fprintf(stderr,"pthread_condattr_init() returns ENOMEM\n"); 38 return PTS_UNRESOLVED; 39 } 40 41 /* Any other returned value means the test failed */ 42 else 43 { 44 printf("Test FAILED\n"); 45 return PTS_FAIL; 46 } 47} 48