Home | History | Annotate | Download | only in pthread_mutexattr_getprotocol
      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_mutexattr_getprotocol()
      9  *
     10  * Gets the protocol attribute of a mutexattr object (which was prev. created
     11  * by the function pthread_mutexattr_init()).
     12  *
     13  * Steps:
     14  * 1.  Initialize a pthread_mutexattr_t object with pthread_mutexattr_init()
     15  * 2.  Call pthread_mutexattr_getprotocol() to obtain the protocol.
     16  *
     17  */
     18 
     19 #include <pthread.h>
     20 #include <stdio.h>
     21 #include <sched.h>
     22 #include "posixtest.h"
     23 
     24 int main(void)
     25 {
     26 
     27 	pthread_mutexattr_t mta;
     28 	int protocol, rc;
     29 
     30 	/* Initialize a mutex attributes object */
     31 	if (pthread_mutexattr_init(&mta) != 0) {
     32 		perror("Error at pthread_mutexattr_init()\n");
     33 		return PTS_UNRESOLVED;
     34 	}
     35 
     36 	/* Get the protocol mutex attr. */
     37 	if ((rc = pthread_mutexattr_getprotocol(&mta, &protocol)) != 0) {
     38 		printf
     39 		    ("Test FAILED: Error in pthread_mutexattr_getprotocol rc=%d\n",
     40 		     rc);
     41 		return PTS_FAIL;
     42 	}
     43 
     44 	printf("Test PASSED\n");
     45 	return PTS_PASS;
     46 }
     47