1/*
2 * Copyright (c) 2002, Intel Corporation. All rights reserved.
3 * Created by:  rolla.n.selbak 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 * A destroyed 'attr' attributes object can be reinitialized using
9 * pthread_attr_init(); the results of otherwise referencing the object
10 * after it has been destroyed are undefined.
11 *
12 * Steps:
13 * 1.  Initialize a pthread_attr_t object using pthread_attr_init()
14 * 2.  Destroy that initialized attribute using pthread_attr_destroy()
15 * 3.  Initialize the pthread_attr_t object again.  This should not result
16 *     in an error.
17 *
18 */
19
20#include <pthread.h>
21#include <stdio.h>
22#include <errno.h>
23#include "posixtest.h"
24
25
26int main()
27{
28	pthread_attr_t new_attr;
29
30	/* Initialize attribute */
31	if(pthread_attr_init(&new_attr) != 0)
32	{
33		perror("Cannot initialize attribute object\n");
34		return PTS_UNRESOLVED;
35	}
36
37	/* Destroy attribute */
38	if(pthread_attr_destroy(&new_attr) != 0)
39	{
40		perror("Cannot destroy the attribute object\n");
41		return PTS_UNRESOLVED;
42	}
43
44	/* Initialize attribute.  This shouldn't result in an error. */
45	if(pthread_attr_init(&new_attr) != 0)
46	{
47		printf("Test FAILED\n");
48		return PTS_FAIL;
49	}
50	else
51	{
52		printf("Test PASSED\n");
53		return PTS_PASS;
54	}
55
56}
57
58
59