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 * Test that pthread_equal()
9 * shall compare the thread ids t1 and t2.  The function shall return a non-zero
10 * value if t1 and t2 are equal, othersise zero shall be returned.
11 * No errors are defined.
12 *
13 * Steps:
14 * 1.  Create a thread
15 * 2.  Call pthread_equal and pass to it the new thread in both parameters.
16 *     They should both be equal.
17 *
18 */
19
20#include <pthread.h>
21#include <stdio.h>
22#include "posixtest.h"
23
24
25void *a_thread_func()
26{
27
28	pthread_exit(0);
29	return NULL;
30}
31
32int main()
33{
34	pthread_t new_th;
35
36	/* Create a new thread. */
37	if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0)
38	{
39		perror("Error creating thread\n");
40		return PTS_UNRESOLVED;
41	}
42
43	/* Call pthread_equal() and pass to it the new thread ID in both
44	 * parameters.  It should return a non-zero value, indicating that
45	 * they are equal. */
46	if(pthread_equal(new_th, new_th) == 0)
47	{
48		printf("Test FAILED\n");
49		return PTS_FAIL;
50	}
51	else
52	{
53		printf("Test PASSED\n");
54		return PTS_PASS;
55	}
56
57}
58
59
60