Home | History | Annotate | Download | only in pthread_rwlockattr_destroy
      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  *  Test that pthread_rwlockattr_destroy()
      8  *    shall destroy a read write attributes object.
      9  *
     10  * Steps:
     11  * 1.  Initialize a pthread_rwlockattr_t object using pthread_rwlockattr_init()
     12  * 2.  Destroy the attributes object using pthread_rwlockattr_destroy()
     13  *
     14  */
     15 
     16 #define _XOPEN_SOURCE 600
     17 #include <pthread.h>
     18 #include <stdio.h>
     19 #include <errno.h>
     20 #include "posixtest.h"
     21 
     22 int main(void)
     23 {
     24 	pthread_rwlockattr_t rwla;
     25 
     26 	int rc;
     27 
     28 	/* Initialize a rwlock attributes object */
     29 	rc = pthread_rwlockattr_init(&rwla);
     30 	if (rc != 0) {
     31 		printf("Error at pthread_rwlockattr_init(), error code: %d\n",
     32 		       rc);
     33 		return PTS_UNRESOLVED;
     34 	}
     35 
     36 	/* Destroy the rwlock attributes object */
     37 	rc = pthread_rwlockattr_destroy(&rwla);
     38 	if (rc != 0) {
     39 		printf
     40 		    ("Error at pthread_rwlockattr_destroy(), error code: %d\n",
     41 		     rc);
     42 		printf("Test FAILED\n");
     43 		return PTS_FAIL;
     44 	}
     45 
     46 	printf("Test PASSED\n");
     47 	return PTS_PASS;
     48 }
     49